{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "from pymongo import MongoClient\n",
    "from pandas.io.json import json_normalize\n",
    "\n",
    "plt.style.use('ggplot')\n",
    "from pylab import mpl\n",
    "mpl.rcParams['font.sans-serif'] = ['SimHei']  #解决seaborn中文字体显示问题\n",
    "plt.rc('figure', figsize=(10, 10))  #把plt默认的图片size调大一点\n",
    "plt.rcParams[\"figure.dpi\"] =mpl.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 546,
   "metadata": {},
   "outputs": [],
   "source": [
    "conn = MongoClient(host='127.0.0.1', port=27017)  # 实例化MongoClient\n",
    "db = conn.get_database('Laborday')  \n",
    "\n",
    "col = db.get_collection('ticket') # 连接到集合ticket\n",
    "mon_data = col.find()  # 查询这个集合下的所有记录"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 547,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = json_normalize([rec for rec in mon_data])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 548,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_csv('data.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>_id</th>\n",
       "      <th>city</th>\n",
       "      <th>fields.cityName</th>\n",
       "      <th>fields.comment</th>\n",
       "      <th>fields.discountPrice</th>\n",
       "      <th>fields.distance</th>\n",
       "      <th>fields.features</th>\n",
       "      <th>fields.featuresNew</th>\n",
       "      <th>fields.fromName</th>\n",
       "      <th>fields.h5_url</th>\n",
       "      <th>...</th>\n",
       "      <th>fields.sold365</th>\n",
       "      <th>fields.soldRecent</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "      <th>fields.subTitle</th>\n",
       "      <th>fields.tagList</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>fields.titleTagInfos</th>\n",
       "      <th>fields.type</th>\n",
       "      <th>src</th>\n",
       "      <th>trip_main_busness_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>25873</th>\n",
       "      <td>5cc71a5f64eeab7d62a581a5</td>\n",
       "      <td>武汉</td>\n",
       "      <td>None</td>\n",
       "      <td>1403</td>\n",
       "      <td>214</td>\n",
       "      <td>None</td>\n",
       "      <td>[{'key': None, 'text': '平均8分钟出票', 'color': Non...</td>\n",
       "      <td>[{'key': None, 'text': '平均8分钟出票', 'color': Non...</td>\n",
       "      <td>None</td>\n",
       "      <td>https://h5.m.taobao.com/trip/travel-detail/ind...</td>\n",
       "      <td>...</td>\n",
       "      <td>已售1.1万+笔</td>\n",
       "      <td>月售315笔</td>\n",
       "      <td>303</td>\n",
       "      <td>None</td>\n",
       "      <td>[]</td>\n",
       "      <td>【当天可订即买即用】武汉汉秀剧场演出门票D区万达汉秀C-B-A-VIP</td>\n",
       "      <td>[]</td>\n",
       "      <td>None</td>\n",
       "      <td>mix</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41256</th>\n",
       "      <td>5cc71b5064eeab7d62a5bdbc</td>\n",
       "      <td>成都</td>\n",
       "      <td>None</td>\n",
       "      <td>0</td>\n",
       "      <td>230</td>\n",
       "      <td>None</td>\n",
       "      <td>[{'key': None, 'text': '最早可定明日票', 'color': Non...</td>\n",
       "      <td>[{'key': None, 'text': '最早可定明日票', 'color': Non...</td>\n",
       "      <td>None</td>\n",
       "      <td>https://h5.m.taobao.com/trip/travel-detail/ind...</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>[]</td>\n",
       "      <td>【官方授权】成都欢乐谷门票日场大门票成人票当天可定成都欢乐谷</td>\n",
       "      <td>[]</td>\n",
       "      <td>None</td>\n",
       "      <td>mix</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44048</th>\n",
       "      <td>5cc71b8464eeab7d62a5c8a4</td>\n",
       "      <td>丽江</td>\n",
       "      <td>None</td>\n",
       "      <td>0</td>\n",
       "      <td>323</td>\n",
       "      <td>None</td>\n",
       "      <td>[{'key': None, 'text': '18:50前可订今日票', 'color':...</td>\n",
       "      <td>[{'key': None, 'text': '18:50前可订今日票', 'color':...</td>\n",
       "      <td>None</td>\n",
       "      <td>https://h5.m.taobao.com/trip/travel-detail/ind...</td>\n",
       "      <td>...</td>\n",
       "      <td>已售3笔</td>\n",
       "      <td>月售1笔</td>\n",
       "      <td>1</td>\n",
       "      <td>None</td>\n",
       "      <td>[]</td>\n",
       "      <td>【在线选座】丽江云南的响声门票 杨丽萍云南的响声演出门票</td>\n",
       "      <td>[]</td>\n",
       "      <td>None</td>\n",
       "      <td>mix</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18667</th>\n",
       "      <td>5cc719e164eeab7d62a5657f</td>\n",
       "      <td>泉州</td>\n",
       "      <td>None</td>\n",
       "      <td>0</td>\n",
       "      <td>34</td>\n",
       "      <td>None</td>\n",
       "      <td>[{'key': None, 'text': '17:00前可订今日票', 'color':...</td>\n",
       "      <td>[{'key': None, 'text': '17:00前可订今日票', 'color':...</td>\n",
       "      <td>None</td>\n",
       "      <td>https://h5.m.taobao.com/trip/travel-detail/ind...</td>\n",
       "      <td>...</td>\n",
       "      <td>已售2笔</td>\n",
       "      <td>月售2笔</td>\n",
       "      <td>2</td>\n",
       "      <td>None</td>\n",
       "      <td>[]</td>\n",
       "      <td>X福建泉州南安香草世界门票 花都香草世界门票 泉州旅游景点门票A</td>\n",
       "      <td>[]</td>\n",
       "      <td>None</td>\n",
       "      <td>mix</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50456</th>\n",
       "      <td>5cc71bed64eeab7d62a5e1ac</td>\n",
       "      <td>上海</td>\n",
       "      <td>None</td>\n",
       "      <td>1838</td>\n",
       "      <td>361</td>\n",
       "      <td>None</td>\n",
       "      <td>[{'key': None, 'text': '18:00前可订今日票', 'color':...</td>\n",
       "      <td>[{'key': None, 'text': '18:00前可订今日票', 'color':...</td>\n",
       "      <td>None</td>\n",
       "      <td>https://h5.m.taobao.com/trip/travel-detail/ind...</td>\n",
       "      <td>...</td>\n",
       "      <td>已售1.5万+笔</td>\n",
       "      <td>月售4270笔</td>\n",
       "      <td>4273</td>\n",
       "      <td>None</td>\n",
       "      <td>[]</td>\n",
       "      <td>上海迪士尼门票一日票 迪士尼门票上海双人 免费领快速通行证 FP</td>\n",
       "      <td>[]</td>\n",
       "      <td>None</td>\n",
       "      <td>mix</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 31 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                            _id city fields.cityName fields.comment  \\\n",
       "25873  5cc71a5f64eeab7d62a581a5   武汉            None           1403   \n",
       "41256  5cc71b5064eeab7d62a5bdbc   成都            None              0   \n",
       "44048  5cc71b8464eeab7d62a5c8a4   丽江            None              0   \n",
       "18667  5cc719e164eeab7d62a5657f   泉州            None              0   \n",
       "50456  5cc71bed64eeab7d62a5e1ac   上海            None           1838   \n",
       "\n",
       "      fields.discountPrice fields.distance  \\\n",
       "25873                  214            None   \n",
       "41256                  230            None   \n",
       "44048                  323            None   \n",
       "18667                   34            None   \n",
       "50456                  361            None   \n",
       "\n",
       "                                         fields.features  \\\n",
       "25873  [{'key': None, 'text': '平均8分钟出票', 'color': Non...   \n",
       "41256  [{'key': None, 'text': '最早可定明日票', 'color': Non...   \n",
       "44048  [{'key': None, 'text': '18:50前可订今日票', 'color':...   \n",
       "18667  [{'key': None, 'text': '17:00前可订今日票', 'color':...   \n",
       "50456  [{'key': None, 'text': '18:00前可订今日票', 'color':...   \n",
       "\n",
       "                                      fields.featuresNew fields.fromName  \\\n",
       "25873  [{'key': None, 'text': '平均8分钟出票', 'color': Non...            None   \n",
       "41256  [{'key': None, 'text': '最早可定明日票', 'color': Non...            None   \n",
       "44048  [{'key': None, 'text': '18:50前可订今日票', 'color':...            None   \n",
       "18667  [{'key': None, 'text': '17:00前可订今日票', 'color':...            None   \n",
       "50456  [{'key': None, 'text': '18:00前可订今日票', 'color':...            None   \n",
       "\n",
       "                                           fields.h5_url  \\\n",
       "25873  https://h5.m.taobao.com/trip/travel-detail/ind...   \n",
       "41256  https://h5.m.taobao.com/trip/travel-detail/ind...   \n",
       "44048  https://h5.m.taobao.com/trip/travel-detail/ind...   \n",
       "18667  https://h5.m.taobao.com/trip/travel-detail/ind...   \n",
       "50456  https://h5.m.taobao.com/trip/travel-detail/ind...   \n",
       "\n",
       "               ...           fields.sold365  fields.soldRecent  \\\n",
       "25873          ...                 已售1.1万+笔             月售315笔   \n",
       "41256          ...                     None               None   \n",
       "44048          ...                     已售3笔               月售1笔   \n",
       "18667          ...                     已售2笔               月售2笔   \n",
       "50456          ...                 已售1.5万+笔            月售4270笔   \n",
       "\n",
       "       fields.soldRecentNum  fields.subTitle fields.tagList  \\\n",
       "25873                   303             None             []   \n",
       "41256                     0             None             []   \n",
       "44048                     1             None             []   \n",
       "18667                     2             None             []   \n",
       "50456                  4273             None             []   \n",
       "\n",
       "                              fields.title fields.titleTagInfos fields.type  \\\n",
       "25873  【当天可订即买即用】武汉汉秀剧场演出门票D区万达汉秀C-B-A-VIP                   []        None   \n",
       "41256       【官方授权】成都欢乐谷门票日场大门票成人票当天可定成都欢乐谷                   []        None   \n",
       "44048         【在线选座】丽江云南的响声门票 杨丽萍云南的响声演出门票                   []        None   \n",
       "18667     X福建泉州南安香草世界门票 花都香草世界门票 泉州旅游景点门票A                   []        None   \n",
       "50456     上海迪士尼门票一日票 迪士尼门票上海双人 免费领快速通行证 FP                   []        None   \n",
       "\n",
       "       src trip_main_busness_type  \n",
       "25873  mix               vocation  \n",
       "41256  mix               vocation  \n",
       "44048  mix               vocation  \n",
       "18667  mix               vocation  \n",
       "50456  mix               vocation  \n",
       "\n",
       "[5 rows x 31 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 54675 entries, 0 to 54674\n",
      "Data columns (total 31 columns):\n",
      "_id                       54675 non-null object\n",
      "city                      54675 non-null object\n",
      "fields.cityName           0 non-null object\n",
      "fields.comment            50187 non-null object\n",
      "fields.discountPrice      54675 non-null object\n",
      "fields.distance           0 non-null object\n",
      "fields.features           54675 non-null object\n",
      "fields.featuresNew        50187 non-null object\n",
      "fields.fromName           0 non-null object\n",
      "fields.h5_url             50187 non-null object\n",
      "fields.itemId             54675 non-null object\n",
      "fields.itemTotalScore     50187 non-null float64\n",
      "fields.latitude           54675 non-null float64\n",
      "fields.longitude          54675 non-null float64\n",
      "fields.native_url         0 non-null object\n",
      "fields.p_score            54675 non-null object\n",
      "fields.pc_url             54675 non-null object\n",
      "fields.picUrl             54675 non-null object\n",
      "fields.price              54675 non-null object\n",
      "fields.scm                50187 non-null object\n",
      "fields.shortInfo          50187 non-null object\n",
      "fields.sold365            32193 non-null object\n",
      "fields.soldRecent         22770 non-null object\n",
      "fields.soldRecentNum      54675 non-null object\n",
      "fields.subTitle           0 non-null object\n",
      "fields.tagList            54675 non-null object\n",
      "fields.title              54675 non-null object\n",
      "fields.titleTagInfos      54675 non-null object\n",
      "fields.type               0 non-null object\n",
      "src                       54675 non-null object\n",
      "trip_main_busness_type    54675 non-null object\n",
      "dtypes: float64(3), object(28)\n",
      "memory usage: 12.9+ MB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1. 清洗数据\n",
    "#### 1.1 把需要的字段挑出来"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['_id', 'city', 'fields.cityName', 'fields.comment',\n",
       "       'fields.discountPrice', 'fields.distance', 'fields.features',\n",
       "       'fields.featuresNew', 'fields.fromName', 'fields.h5_url',\n",
       "       'fields.itemId', 'fields.itemTotalScore', 'fields.latitude',\n",
       "       'fields.longitude', 'fields.native_url', 'fields.p_score',\n",
       "       'fields.pc_url', 'fields.picUrl', 'fields.price', 'fields.scm',\n",
       "       'fields.shortInfo', 'fields.sold365', 'fields.soldRecent',\n",
       "       'fields.soldRecentNum', 'fields.subTitle', 'fields.tagList',\n",
       "       'fields.title', 'fields.titleTagInfos', 'fields.type', 'src',\n",
       "       'trip_main_busness_type'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "_id                                                5cc718a064eeab7d62a51ccb\n",
       "city                                                                    石家庄\n",
       "fields.cityName                                                        None\n",
       "fields.comment                                                            0\n",
       "fields.discountPrice                                                  116.9\n",
       "fields.distance                                                        None\n",
       "fields.features           [{'key': None, 'text': '18:00前可订今日票', 'color':...\n",
       "fields.featuresNew        [{'key': None, 'text': '18:00前可订今日票', 'color':...\n",
       "fields.fromName                                                        None\n",
       "fields.h5_url             https://h5.m.taobao.com/trip/travel-detail/ind...\n",
       "fields.itemId                                                  588857206136\n",
       "fields.itemTotalScore                                                     0\n",
       "fields.latitude                                                           0\n",
       "fields.longitude                                                          0\n",
       "fields.native_url                                                      None\n",
       "fields.p_score                                                            0\n",
       "fields.pc_url             https://traveldetail.fliggy.com/item.htm?id=58...\n",
       "fields.picUrl             https://img.alicdn.com/bao/uploaded/i8/TB1PMut...\n",
       "fields.price                                                          116.9\n",
       "fields.scm                 20140635.-2_1_10..0be2dd1515565518031432429ef690\n",
       "fields.shortInfo                                                        石家庄\n",
       "fields.sold365                                                         已售4笔\n",
       "fields.soldRecent                                                      月售4笔\n",
       "fields.soldRecentNum                                                      4\n",
       "fields.subTitle                                                        None\n",
       "fields.tagList                                                           []\n",
       "fields.title                                    【电子票】石家庄法米动物园门票_蜂巢法米动物乐园成人票\n",
       "fields.titleTagInfos                                                     []\n",
       "fields.type                                                            None\n",
       "src                                                                     mix\n",
       "trip_main_busness_type                                             vocation\n",
       "Name: 55, dtype: object"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.iloc[55]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "col_keep = ['city', 'fields.comment', 'fields.discountPrice', 'fields.features', 'fields.itemId',\n",
    "           'fields.itemTotalScore', 'fields.latitude', 'fields.longitude', 'fields.price',\n",
    "           'fields.shortInfo', 'fields.sold365', 'fields.soldRecentNum', 'fields.tagList', \n",
    "            'fields.title', 'trip_main_busness_type']\n",
    "data = data[col_keep]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 54675 entries, 0 to 54674\n",
      "Data columns (total 15 columns):\n",
      "city                      54675 non-null object\n",
      "fields.comment            50187 non-null object\n",
      "fields.discountPrice      54675 non-null object\n",
      "fields.features           54675 non-null object\n",
      "fields.itemId             54675 non-null object\n",
      "fields.itemTotalScore     50187 non-null float64\n",
      "fields.latitude           54675 non-null float64\n",
      "fields.longitude          54675 non-null float64\n",
      "fields.price              54675 non-null object\n",
      "fields.shortInfo          50187 non-null object\n",
      "fields.sold365            32193 non-null object\n",
      "fields.soldRecentNum      54675 non-null object\n",
      "fields.tagList            54675 non-null object\n",
      "fields.title              54675 non-null object\n",
      "trip_main_busness_type    54675 non-null object\n",
      "dtypes: float64(3), object(12)\n",
      "memory usage: 6.3+ MB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>city</th>\n",
       "      <th>fields.comment</th>\n",
       "      <th>fields.discountPrice</th>\n",
       "      <th>fields.features</th>\n",
       "      <th>fields.itemId</th>\n",
       "      <th>fields.itemTotalScore</th>\n",
       "      <th>fields.latitude</th>\n",
       "      <th>fields.longitude</th>\n",
       "      <th>fields.price</th>\n",
       "      <th>fields.shortInfo</th>\n",
       "      <th>fields.sold365</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "      <th>fields.tagList</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>trip_main_busness_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>48231</th>\n",
       "      <td>北京</td>\n",
       "      <td>255</td>\n",
       "      <td>22</td>\n",
       "      <td>[{'key': None, 'text': '13:30前可订今日票', 'color':...</td>\n",
       "      <td>40271420829</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>22</td>\n",
       "      <td>北京</td>\n",
       "      <td>已售1636笔</td>\n",
       "      <td>41</td>\n",
       "      <td>[]</td>\n",
       "      <td>【自动发码】北京汽车博物馆 北京汽车博物馆电子票</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10301</th>\n",
       "      <td>杭州</td>\n",
       "      <td>6</td>\n",
       "      <td>78</td>\n",
       "      <td>[{'key': None, 'text': '15:00前可订今日票', 'color':...</td>\n",
       "      <td>564944193109</td>\n",
       "      <td>4.6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>78</td>\n",
       "      <td>杭州</td>\n",
       "      <td>已售58笔</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>浙江杭州东方文化园门票电子票含万佛金塔地宫+观音显圣+道苑天宫</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53053</th>\n",
       "      <td>香港</td>\n",
       "      <td>571</td>\n",
       "      <td>567.5</td>\n",
       "      <td>[{'key': None, 'text': '17:00前可订今日票', 'color':...</td>\n",
       "      <td>559918262990</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>567.5</td>\n",
       "      <td>香港</td>\n",
       "      <td>已售5269笔</td>\n",
       "      <td>647</td>\n",
       "      <td>[]</td>\n",
       "      <td>赠商品优惠券 香港迪士尼门票2日票 香港迪斯尼乐园官方保障</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5545</th>\n",
       "      <td>盐城</td>\n",
       "      <td>9</td>\n",
       "      <td>85.5</td>\n",
       "      <td>[{'key': None, 'text': '12:00前可订今日票', 'color':...</td>\n",
       "      <td>570386677874</td>\n",
       "      <td>4.8</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.5</td>\n",
       "      <td>盐城</td>\n",
       "      <td>已售144笔</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>当日可订|江苏盐城大丰港海洋世界成人门票海洋世界儿童门票</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>623</th>\n",
       "      <td>保定</td>\n",
       "      <td>0</td>\n",
       "      <td>65</td>\n",
       "      <td>[{'key': None, 'text': '22:00前可订今日票', 'color':...</td>\n",
       "      <td>586810242474</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>65</td>\n",
       "      <td>保定</td>\n",
       "      <td>已售5笔</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>da wu 温泉度假村 大门票</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      city fields.comment fields.discountPrice  \\\n",
       "48231   北京            255                   22   \n",
       "10301   杭州              6                   78   \n",
       "53053   香港            571                567.5   \n",
       "5545    盐城              9                 85.5   \n",
       "623     保定              0                   65   \n",
       "\n",
       "                                         fields.features fields.itemId  \\\n",
       "48231  [{'key': None, 'text': '13:30前可订今日票', 'color':...   40271420829   \n",
       "10301  [{'key': None, 'text': '15:00前可订今日票', 'color':...  564944193109   \n",
       "53053  [{'key': None, 'text': '17:00前可订今日票', 'color':...  559918262990   \n",
       "5545   [{'key': None, 'text': '12:00前可订今日票', 'color':...  570386677874   \n",
       "623    [{'key': None, 'text': '22:00前可订今日票', 'color':...  586810242474   \n",
       "\n",
       "       fields.itemTotalScore  fields.latitude  fields.longitude fields.price  \\\n",
       "48231                    5.0              0.0               0.0           22   \n",
       "10301                    4.6              0.0               0.0           78   \n",
       "53053                    5.0              0.0               0.0        567.5   \n",
       "5545                     4.8              0.0               0.0         85.5   \n",
       "623                      0.0              0.0               0.0           65   \n",
       "\n",
       "      fields.shortInfo fields.sold365 fields.soldRecentNum fields.tagList  \\\n",
       "48231               北京        已售1636笔                   41             []   \n",
       "10301               杭州          已售58笔                    0             []   \n",
       "53053               香港        已售5269笔                  647             []   \n",
       "5545                盐城         已售144笔                    0             []   \n",
       "623                 保定           已售5笔                    0             []   \n",
       "\n",
       "                          fields.title trip_main_busness_type  \n",
       "48231         【自动发码】北京汽车博物馆 北京汽车博物馆电子票               vocation  \n",
       "10301  浙江杭州东方文化园门票电子票含万佛金塔地宫+观音显圣+道苑天宫               vocation  \n",
       "53053    赠商品优惠券 香港迪士尼门票2日票 香港迪斯尼乐园官方保障               vocation  \n",
       "5545      当日可订|江苏盐城大丰港海洋世界成人门票海洋世界儿童门票               vocation  \n",
       "623                    da wu 温泉度假村 大门票               vocation  "
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.sample(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.2 去重"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.drop_duplicates(subset='fields.itemId', inplace=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.3 数据类型转换"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 由于np.nan是float，所以这里整体转换为float\n",
    "data.loc[data['fields.comment'].isnull(), 'fields.comment'] = np.nan\n",
    "data['fields.comment'] = data['fields.comment'].astype(float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['fields.discountPrice'] = data['fields.discountPrice'].astype(float)\n",
    "data['fields.itemId'] = data['fields.itemId'].astype(int)\n",
    "data['fields.price'] = data['fields.price'].astype(float)\n",
    "data['fields.soldRecentNum'] = data['fields.soldRecentNum'].astype(int)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.4 各字段清洗\n",
    "- fields.features\n",
    "- fields.sold365\n",
    "- fields.tagList"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>city</th>\n",
       "      <th>fields.comment</th>\n",
       "      <th>fields.discountPrice</th>\n",
       "      <th>fields.features</th>\n",
       "      <th>fields.itemId</th>\n",
       "      <th>fields.itemTotalScore</th>\n",
       "      <th>fields.latitude</th>\n",
       "      <th>fields.longitude</th>\n",
       "      <th>fields.price</th>\n",
       "      <th>fields.shortInfo</th>\n",
       "      <th>fields.sold365</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "      <th>fields.tagList</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>trip_main_busness_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>44352</th>\n",
       "      <td>昭通</td>\n",
       "      <td>0.0</td>\n",
       "      <td>125.0</td>\n",
       "      <td>[{'key': None, 'text': '21:00前可订今日票', 'color':...</td>\n",
       "      <td>588131795444</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>125.0</td>\n",
       "      <td>昭通</td>\n",
       "      <td>None</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>【提前1小时预订】昭通西部大峡谷温泉门票+盐疗票+汗蒸票+鱼疗票</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22987</th>\n",
       "      <td>日照</td>\n",
       "      <td>2.0</td>\n",
       "      <td>180.0</td>\n",
       "      <td>[{'key': None, 'text': '15:00前可订今日票', 'color':...</td>\n",
       "      <td>574386609814</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>180.0</td>\n",
       "      <td>日照</td>\n",
       "      <td>已售12笔</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>【官方通票 即买即用】山东日照海洋公园门票</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52800</th>\n",
       "      <td>重庆</td>\n",
       "      <td>0.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>[{'key': None, 'text': '17:30前可订今日票', 'color':...</td>\n",
       "      <td>592668151775</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>28.0</td>\n",
       "      <td>重庆</td>\n",
       "      <td>None</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>垫江乐天花谷hss000kk</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8879</th>\n",
       "      <td>江阴</td>\n",
       "      <td>NaN</td>\n",
       "      <td>105.0</td>\n",
       "      <td>[{'key': '一句话描述', 'text': '登上金塔可以纵览华西村美景，那尊超级金...</td>\n",
       "      <td>19644</td>\n",
       "      <td>NaN</td>\n",
       "      <td>31.8222</td>\n",
       "      <td>120.439</td>\n",
       "      <td>105.0</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>45</td>\n",
       "      <td>[{'text': '4A景区', 'icon': None, 'borderColor':...</td>\n",
       "      <td>华西村</td>\n",
       "      <td>scenic</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21353</th>\n",
       "      <td>青岛</td>\n",
       "      <td>328.0</td>\n",
       "      <td>280.0</td>\n",
       "      <td>[{'key': None, 'text': '17:00前可订今日票', 'color':...</td>\n",
       "      <td>42341468949</td>\n",
       "      <td>4.7</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>280.0</td>\n",
       "      <td>青岛</td>\n",
       "      <td>已售4024笔</td>\n",
       "      <td>92</td>\n",
       "      <td>[]</td>\n",
       "      <td>【方特官方门票】青岛方特梦幻王国门票 身份证入园极速出票</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      city  fields.comment  fields.discountPrice  \\\n",
       "44352   昭通             0.0                 125.0   \n",
       "22987   日照             2.0                 180.0   \n",
       "52800   重庆             0.0                  28.0   \n",
       "8879    江阴             NaN                 105.0   \n",
       "21353   青岛           328.0                 280.0   \n",
       "\n",
       "                                         fields.features  fields.itemId  \\\n",
       "44352  [{'key': None, 'text': '21:00前可订今日票', 'color':...   588131795444   \n",
       "22987  [{'key': None, 'text': '15:00前可订今日票', 'color':...   574386609814   \n",
       "52800  [{'key': None, 'text': '17:30前可订今日票', 'color':...   592668151775   \n",
       "8879   [{'key': '一句话描述', 'text': '登上金塔可以纵览华西村美景，那尊超级金...          19644   \n",
       "21353  [{'key': None, 'text': '17:00前可订今日票', 'color':...    42341468949   \n",
       "\n",
       "       fields.itemTotalScore  fields.latitude  fields.longitude  fields.price  \\\n",
       "44352                    0.0           0.0000             0.000         125.0   \n",
       "22987                    5.0           0.0000             0.000         180.0   \n",
       "52800                    0.0           0.0000             0.000          28.0   \n",
       "8879                     NaN          31.8222           120.439         105.0   \n",
       "21353                    4.7           0.0000             0.000         280.0   \n",
       "\n",
       "      fields.shortInfo fields.sold365  fields.soldRecentNum  \\\n",
       "44352               昭通           None                     0   \n",
       "22987               日照          已售12笔                     0   \n",
       "52800               重庆           None                     0   \n",
       "8879              None           None                    45   \n",
       "21353               青岛        已售4024笔                    92   \n",
       "\n",
       "                                          fields.tagList  \\\n",
       "44352                                                 []   \n",
       "22987                                                 []   \n",
       "52800                                                 []   \n",
       "8879   [{'text': '4A景区', 'icon': None, 'borderColor':...   \n",
       "21353                                                 []   \n",
       "\n",
       "                           fields.title trip_main_busness_type  \n",
       "44352  【提前1小时预订】昭通西部大峡谷温泉门票+盐疗票+汗蒸票+鱼疗票               vocation  \n",
       "22987             【官方通票 即买即用】山东日照海洋公园门票               vocation  \n",
       "52800                    垫江乐天花谷hss000kk               vocation  \n",
       "8879                                华西村                 scenic  \n",
       "21353      【方特官方门票】青岛方特梦幻王国门票 身份证入园极速出票               vocation  "
      ]
     },
     "execution_count": 129,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {},
   "outputs": [],
   "source": [
    "# fields.features清洗\n",
    "def get_fea_text(data):\n",
    "    if len(data) > 0:\n",
    "        return data[0]['text']\n",
    "    else:\n",
    "        return None\n",
    "\n",
    "\n",
    "data['fields.features'] = data['fields.features'].apply(get_fea_text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 205,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "47279     已售1228笔\n",
       "30354    已售1.2万+笔\n",
       "33668        已售3笔\n",
       "4790      已售1334笔\n",
       "36201        已售8笔\n",
       "Name: fields.sold365, dtype: object"
      ]
     },
     "execution_count": 205,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['fields.sold365'].sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 211,
   "metadata": {},
   "outputs": [],
   "source": [
    "# fields.sold365清洗\n",
    "def get_sold365(data):\n",
    "    if data is None:\n",
    "        return np.nan\n",
    "    if \"万\" in data:\n",
    "        return float(data[data.find('售')+1:data.find('万')]) * 10000\n",
    "    else:\n",
    "        return float(data[data.find('售')+1:data.find('笔')])\n",
    "\n",
    "    \n",
    "data['fields.sold365'] = data['fields.sold365'].apply(get_sold365)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 229,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "47667                                                   []\n",
       "23081                                                   []\n",
       "2395                                                    []\n",
       "23734    [{'text': 'AAA', 'icon': None, 'borderColor': ...\n",
       "18676                                                   []\n",
       "Name: fields.tagList, dtype: object"
      ]
     },
     "execution_count": 229,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['fields.tagList'].sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 230,
   "metadata": {},
   "outputs": [],
   "source": [
    "# fields.tagList清洗\n",
    "data['fields.tagList'] = data['fields.tagList'].apply(get_fea_text)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1.5 跟省份数据merge在一起"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 242,
   "metadata": {},
   "outputs": [],
   "source": [
    "city_data = pd.read_csv('city_data.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 243,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>city</th>\n",
       "      <th>province</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>石家庄</td>\n",
       "      <td>河北省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>邯郸</td>\n",
       "      <td>河北省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>唐山</td>\n",
       "      <td>河北省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>保定</td>\n",
       "      <td>河北省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>秦皇岛</td>\n",
       "      <td>河北省</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  city province\n",
       "0  石家庄      河北省\n",
       "1   邯郸      河北省\n",
       "2   唐山      河北省\n",
       "3   保定      河北省\n",
       "4  秦皇岛      河北省"
      ]
     },
     "execution_count": 243,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "city_data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 244,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_final = data.merge(city_data, on='city')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 257,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>city</th>\n",
       "      <th>fields.comment</th>\n",
       "      <th>fields.discountPrice</th>\n",
       "      <th>fields.features</th>\n",
       "      <th>fields.itemId</th>\n",
       "      <th>fields.itemTotalScore</th>\n",
       "      <th>fields.latitude</th>\n",
       "      <th>fields.longitude</th>\n",
       "      <th>fields.price</th>\n",
       "      <th>fields.shortInfo</th>\n",
       "      <th>fields.sold365</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "      <th>fields.tagList</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>trip_main_busness_type</th>\n",
       "      <th>province</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>48253</th>\n",
       "      <td>澳门</td>\n",
       "      <td>2.0</td>\n",
       "      <td>95.0</td>\n",
       "      <td>20:00前可订今日票</td>\n",
       "      <td>543230350208</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>100.00</td>\n",
       "      <td>澳门</td>\n",
       "      <td>22.0</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>澳门观光塔门票旅游塔门票澳门旅游澳门景点门票澳门塔门票</td>\n",
       "      <td>vocation</td>\n",
       "      <td>澳门</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14801</th>\n",
       "      <td>厦门</td>\n",
       "      <td>13.0</td>\n",
       "      <td>348.0</td>\n",
       "      <td>平均1分钟出票</td>\n",
       "      <td>544042938836</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>348.00</td>\n",
       "      <td>厦门</td>\n",
       "      <td>171.0</td>\n",
       "      <td>9</td>\n",
       "      <td>None</td>\n",
       "      <td>【温泉门票+SPA（二选一）+鱼疗】厦门旅游 日月谷温泉 景点门票</td>\n",
       "      <td>vocation</td>\n",
       "      <td>福建省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3509</th>\n",
       "      <td>长春</td>\n",
       "      <td>0.0</td>\n",
       "      <td>98.0</td>\n",
       "      <td>16:53前可订今日票</td>\n",
       "      <td>581974218403</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>98.00</td>\n",
       "      <td>长春</td>\n",
       "      <td>3.0</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>C【即买即用】长春 关东文化园门票 关东文化园温泉票</td>\n",
       "      <td>vocation</td>\n",
       "      <td>吉林省</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45283</th>\n",
       "      <td>上海</td>\n",
       "      <td>0.0</td>\n",
       "      <td>22.6</td>\n",
       "      <td>14:30前可订今日票</td>\n",
       "      <td>590474254915</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>22.60</td>\n",
       "      <td>上海</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>上海 滨海森林公园 大门票 滨海旅游 度假区 成人票学生票老人票</td>\n",
       "      <td>vocation</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45002</th>\n",
       "      <td>上海</td>\n",
       "      <td>0.0</td>\n",
       "      <td>118.8</td>\n",
       "      <td>08:30前可订今日票</td>\n",
       "      <td>588030049902</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>118.81</td>\n",
       "      <td>上海</td>\n",
       "      <td>8.0</td>\n",
       "      <td>5</td>\n",
       "      <td>None</td>\n",
       "      <td>【快速出票 刷身份证】上海野生动物园门票上海野生动物成人票</td>\n",
       "      <td>vocation</td>\n",
       "      <td>上海市</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      city  fields.comment  fields.discountPrice fields.features  \\\n",
       "48253   澳门             2.0                  95.0     20:00前可订今日票   \n",
       "14801   厦门            13.0                 348.0         平均1分钟出票   \n",
       "3509    长春             0.0                  98.0     16:53前可订今日票   \n",
       "45283   上海             0.0                  22.6     14:30前可订今日票   \n",
       "45002   上海             0.0                 118.8     08:30前可订今日票   \n",
       "\n",
       "       fields.itemId  fields.itemTotalScore  fields.latitude  \\\n",
       "48253   543230350208                    5.0              0.0   \n",
       "14801   544042938836                    5.0              0.0   \n",
       "3509    581974218403                    0.0              0.0   \n",
       "45283   590474254915                    0.0              0.0   \n",
       "45002   588030049902                    0.0              0.0   \n",
       "\n",
       "       fields.longitude  fields.price fields.shortInfo  fields.sold365  \\\n",
       "48253               0.0        100.00               澳门            22.0   \n",
       "14801               0.0        348.00               厦门           171.0   \n",
       "3509                0.0         98.00               长春             3.0   \n",
       "45283               0.0         22.60               上海             NaN   \n",
       "45002               0.0        118.81               上海             8.0   \n",
       "\n",
       "       fields.soldRecentNum fields.tagList                       fields.title  \\\n",
       "48253                     0           None        澳门观光塔门票旅游塔门票澳门旅游澳门景点门票澳门塔门票   \n",
       "14801                     9           None  【温泉门票+SPA（二选一）+鱼疗】厦门旅游 日月谷温泉 景点门票   \n",
       "3509                      0           None         C【即买即用】长春 关东文化园门票 关东文化园温泉票   \n",
       "45283                     0           None   上海 滨海森林公园 大门票 滨海旅游 度假区 成人票学生票老人票   \n",
       "45002                     5           None      【快速出票 刷身份证】上海野生动物园门票上海野生动物成人票   \n",
       "\n",
       "      trip_main_busness_type province  \n",
       "48253               vocation       澳门  \n",
       "14801               vocation      福建省  \n",
       "3509                vocation      吉林省  \n",
       "45283               vocation      上海市  \n",
       "45002               vocation      上海市  "
      ]
     },
     "execution_count": 257,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_final.sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 256,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_final.to_csv('data_clean.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 542,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 48537 entries, 0 to 48536\n",
      "Data columns (total 17 columns):\n",
      "city                      48537 non-null object\n",
      "fields.comment            44643 non-null float64\n",
      "fields.discountPrice      48537 non-null float64\n",
      "fields.features           48332 non-null object\n",
      "fields.itemId             48537 non-null int64\n",
      "fields.itemTotalScore     44643 non-null float64\n",
      "fields.latitude           48537 non-null float64\n",
      "fields.longitude          48537 non-null float64\n",
      "fields.price              48537 non-null float64\n",
      "fields.shortInfo          44643 non-null object\n",
      "fields.sold365            28057 non-null float64\n",
      "fields.soldRecentNum      48537 non-null int64\n",
      "fields.tagList            1743 non-null object\n",
      "fields.title              48537 non-null object\n",
      "trip_main_busness_type    48537 non-null object\n",
      "province                  48537 non-null object\n",
      "discount                  48537 non-null float64\n",
      "dtypes: float64(8), int64(2), object(7)\n",
      "memory usage: 7.9+ MB\n"
     ]
    }
   ],
   "source": [
    "data_final.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 问题\n",
    "1. 哪些城市/省份的旅游选择最多？\n",
    "2. 哪些城市最受游客青睐？\n",
    "3. 最热门的景点\n",
    "4. 各省份的好评热门景点\n",
    "5. 很热门但是评分不好的景点\n",
    "6. 打折力度最大的景点\n",
    "7. 各级别景区的门票价格"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 1. 哪些城市/省份的旅游选择最多？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 259,
   "metadata": {},
   "outputs": [],
   "source": [
    "count_top12 = data_final['fields.shortInfo'].value_counts()[:12]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 280,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"9799c97234b147738c201e95a0e5bc70\" style=\"width:800px;height:600px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_9799c97234b147738c201e95a0e5bc70 = echarts.init(document.getElementById('9799c97234b147738c201e95a0e5bc70'), null, {renderer: 'canvas'});\n",
       "var option_9799c97234b147738c201e95a0e5bc70 = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u65c5\\u6e38\\u9009\\u62e9\\u6700\\u591a\\u7684\\u524d12\\u4e2a\\u57ce\\u5e02\",\n",
       "            \"subtext\": \"\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"color\": \"#000\",\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"color\": \"#aaa\",\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4e0b\\u8f7d\\u56fe\\u7247\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 5008764,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"formatter\": null,\n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#fff\",\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"funnel\",\n",
       "            \"name\": \"\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u4e09\\u4e9a\",\n",
       "                    \"value\": 2941.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u676d\\u5dde\",\n",
       "                    \"value\": 1710.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u4eac\",\n",
       "                    \"value\": 1597.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6842\\u6797\",\n",
       "                    \"value\": 1499.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e0a\\u6d77\",\n",
       "                    \"value\": 1491.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u5dde\",\n",
       "                    \"value\": 1208.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u53a6\\u95e8\",\n",
       "                    \"value\": 1114.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u82cf\\u5dde\",\n",
       "                    \"value\": 913.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9999\\u6e2f\",\n",
       "                    \"value\": 910.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6210\\u90fd\",\n",
       "                    \"value\": 905.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u91cd\\u5e86\",\n",
       "                    \"value\": 886.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e05\\u8fdc\",\n",
       "                    \"value\": 882.0\n",
       "                }\n",
       "            ],\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#000\",\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": null\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": null,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#fff\",\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\\u5e7f\\u5dde\",\n",
       "                \"\\u53a6\\u95e8\",\n",
       "                \"\\u6842\\u6797\",\n",
       "                \"\\u4e09\\u4e9a\",\n",
       "                \"\\u6e05\\u8fdc\",\n",
       "                \"\\u5317\\u4eac\",\n",
       "                \"\\u6210\\u90fd\",\n",
       "                \"\\u82cf\\u5dde\",\n",
       "                \"\\u9999\\u6e2f\",\n",
       "                \"\\u4e0a\\u6d77\",\n",
       "                \"\\u91cd\\u5e86\",\n",
       "                \"\\u676d\\u5dde\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": 30,\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12,\n",
       "                \"color\": \"#333\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"backgroundColor\": \"#fff\",\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_9799c97234b147738c201e95a0e5bc70.setOption(option_9799c97234b147738c201e95a0e5bc70);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.funnel.Funnel at 0x11e7b2278>"
      ]
     },
     "execution_count": 280,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Funnel\n",
    "\n",
    "funnel = Funnel(\"旅游选择最多的前12个城市\", width = 800,height=600)\n",
    "funnel.add(\"\", count_top12.index, count_top12.values, legend_top=30,\n",
    "           xaxis_label_textsize=20, yaxis_label_textsize=14, is_label_show=True,\n",
    "          )\n",
    "funnel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 287,
   "metadata": {},
   "outputs": [],
   "source": [
    "count_province_top10 = data_final['province'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 297,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "广东省         4943\n",
       "浙江省         4688\n",
       "海南省         3907\n",
       "江苏省         3889\n",
       "山东省         2853\n",
       "福建省         2818\n",
       "广西壮族自治区     2391\n",
       "湖北省         2106\n",
       "北京市         1658\n",
       "安徽省         1610\n",
       "四川省         1548\n",
       "云南省         1541\n",
       "辽宁省         1480\n",
       "河北省         1403\n",
       "上海市         1358\n",
       "河南省         1313\n",
       "江西省         1255\n",
       "陕西省         1104\n",
       "重庆市          955\n",
       "香港           923\n",
       "湖南省          778\n",
       "澳门           644\n",
       "黑龙江省         604\n",
       "甘肃省          467\n",
       "天津市          430\n",
       "贵州省          368\n",
       "山西省          364\n",
       "宁夏回族自治区      305\n",
       "吉林省          271\n",
       "内蒙古自治区       151\n",
       "台湾           142\n",
       "西藏自治区        141\n",
       "新疆维吾尔自治区      90\n",
       "青海省           39\n",
       "Name: province, dtype: int64"
      ]
     },
     "execution_count": 297,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "count_province_top10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 294,
   "metadata": {},
   "outputs": [],
   "source": [
    "province = [pro.replace(\"省\", \"\") for pro in list(count_province_top10.index)]\n",
    "province = [pro.replace(\"市\", \"\") for pro in province]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 302,
   "metadata": {},
   "outputs": [],
   "source": [
    "province = ['广东','浙江','海南','江苏','山东','福建','广西','湖北','北京','安徽','四川','云南',\n",
    "            '辽宁','河北','上海','河南','江西','陕西','重庆','香港','湖南','澳门','黑龙江','甘肃',\n",
    "            '天津','贵州','山西','宁夏','吉林','内蒙古','台湾','西藏',\n",
    "            '新疆','青海']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 541,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min', 'china': '/nbextensions/echarts-countries-js/china'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"a2028b5770584397ad1ca665ca29d11a\" style=\"width:600px;height:600px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts', 'china'], function(echarts) {\n",
       "        \n",
       "var myChart_a2028b5770584397ad1ca665ca29d11a = echarts.init(document.getElementById('a2028b5770584397ad1ca665ca29d11a'), null, {renderer: 'canvas'});\n",
       "var option_a2028b5770584397ad1ca665ca29d11a = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u5168\\u56fd\\u5404\\u7701\\u4efd\\u65c5\\u6e38\\u9009\\u62e9\\u6570\\u91cf\\u56fe\",\n",
       "            \"subtext\": \"\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"color\": \"#000\",\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"color\": \"#aaa\",\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4e0b\\u8f7d\\u56fe\\u7247\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 4323729,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"formatter\": null,\n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#fff\",\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"map\",\n",
       "            \"name\": \"\",\n",
       "            \"symbol\": \"circle\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": false,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#000\",\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": null\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": null,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#fff\",\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"mapType\": \"china\",\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u4e1c\",\n",
       "                    \"value\": 4943.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d59\\u6c5f\",\n",
       "                    \"value\": 4688.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d77\\u5357\",\n",
       "                    \"value\": 3907.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u82cf\",\n",
       "                    \"value\": 3889.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u4e1c\",\n",
       "                    \"value\": 2853.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u798f\\u5efa\",\n",
       "                    \"value\": 2818.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e7f\\u897f\",\n",
       "                    \"value\": 2391.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5317\",\n",
       "                    \"value\": 2106.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u4eac\",\n",
       "                    \"value\": 1658.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b89\\u5fbd\",\n",
       "                    \"value\": 1610.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u56db\\u5ddd\",\n",
       "                    \"value\": 1548.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e91\\u5357\",\n",
       "                    \"value\": 1541.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8fbd\\u5b81\",\n",
       "                    \"value\": 1480.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5317\",\n",
       "                    \"value\": 1403.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u4e0a\\u6d77\",\n",
       "                    \"value\": 1358.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6cb3\\u5357\",\n",
       "                    \"value\": 1313.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6c5f\\u897f\",\n",
       "                    \"value\": 1255.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9655\\u897f\",\n",
       "                    \"value\": 1104.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u91cd\\u5e86\",\n",
       "                    \"value\": 955.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9999\\u6e2f\",\n",
       "                    \"value\": 923.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6e56\\u5357\",\n",
       "                    \"value\": 778.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6fb3\\u95e8\",\n",
       "                    \"value\": 644.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9ed1\\u9f99\\u6c5f\",\n",
       "                    \"value\": 604.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u7518\\u8083\",\n",
       "                    \"value\": 467.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5929\\u6d25\",\n",
       "                    \"value\": 430.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u8d35\\u5dde\",\n",
       "                    \"value\": 368.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5c71\\u897f\",\n",
       "                    \"value\": 364.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b81\\u590f\",\n",
       "                    \"value\": 305.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5409\\u6797\",\n",
       "                    \"value\": 271.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5185\\u8499\\u53e4\",\n",
       "                    \"value\": 151.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u53f0\\u6e7e\",\n",
       "                    \"value\": 142.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u897f\\u85cf\",\n",
       "                    \"value\": 141.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65b0\\u7586\",\n",
       "                    \"value\": 90.0\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9752\\u6d77\",\n",
       "                    \"value\": 39.0\n",
       "                }\n",
       "            ],\n",
       "            \"roam\": true,\n",
       "            \"showLegendSymbol\": true\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12,\n",
       "                \"color\": \"#333\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"backgroundColor\": \"#fff\",\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ],\n",
       "    \"visualMap\": {\n",
       "        \"type\": \"continuous\",\n",
       "        \"min\": 0,\n",
       "        \"max\": 5000,\n",
       "        \"text\": [\n",
       "            \"high\",\n",
       "            \"low\"\n",
       "        ],\n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#000\"\n",
       "        },\n",
       "        \"inRange\": {\n",
       "            \"color\": [\n",
       "                \"#50a3ba\",\n",
       "                \"#eac763\",\n",
       "                \"#d94e5d\"\n",
       "            ]\n",
       "        },\n",
       "        \"calculable\": true,\n",
       "        \"splitNumber\": 5,\n",
       "        \"dimension\": null,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"left\",\n",
       "        \"top\": \"bottom\",\n",
       "        \"showLabel\": true\n",
       "    }\n",
       "};\n",
       "myChart_a2028b5770584397ad1ca665ca29d11a.setOption(option_a2028b5770584397ad1ca665ca29d11a);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.map.Map at 0x11f6b65c0>"
      ]
     },
     "execution_count": 541,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Map\n",
    "\n",
    "\n",
    "map = Map(\"全国各省份旅游选择数量图\", width=600, height=600)\n",
    "map.add(\n",
    "    \"\",\n",
    "    province,\n",
    "    count_province_top10.values,\n",
    "    maptype=\"china\",\n",
    "    is_visualmap=True,\n",
    "    visual_text_color=\"#000\",\n",
    "    visual_range=[0, 5000]\n",
    ")\n",
    "map"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 2. 哪些城市最受游客青睐？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 354,
   "metadata": {},
   "outputs": [],
   "source": [
    "city_sale_top10 = data_final.groupby('fields.shortInfo')['fields.soldRecentNum'].sum().nlargest(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 356,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"aa2f97b8fff44f54972ad87dc06105f4\" style=\"width:700px;height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_aa2f97b8fff44f54972ad87dc06105f4 = echarts.init(document.getElementById('aa2f97b8fff44f54972ad87dc06105f4'), null, {renderer: 'canvas'});\n",
       "var option_aa2f97b8fff44f54972ad87dc06105f4 = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6700\\u8fd1\\u4e00\\u4e2a\\u6708\\u552e\\u51fa\\u95e8\\u7968Top10\\u57ce\\u5e02\",\n",
       "            \"subtext\": \"\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"color\": \"#000\",\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"color\": \"#aaa\",\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4e0b\\u8f7d\\u56fe\\u7247\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 2294578,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"formatter\": null,\n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#fff\",\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\",\n",
       "            \"data\": [\n",
       "                170324.0,\n",
       "                130630.0,\n",
       "                64395.0,\n",
       "                55927.0,\n",
       "                45164.0,\n",
       "                38172.0,\n",
       "                32728.0,\n",
       "                32124.0,\n",
       "                31851.0,\n",
       "                29745.0\n",
       "            ],\n",
       "            \"stack\": \"stack_2294578\",\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#000\",\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": null\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": null,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#fff\",\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 2294578\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12,\n",
       "                \"color\": \"#333\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"backgroundColor\": \"#fff\",\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"name\": \"\",\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 20,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 18,\n",
       "                    \"color\": \"#000\"\n",
       "                }\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"position\": null,\n",
       "            \"boundaryGap\": true,\n",
       "            \"min\": null,\n",
       "            \"max\": null,\n",
       "            \"data\": [\n",
       "                \"\\u676d\\u5dde\",\n",
       "                \"\\u4e0a\\u6d77\",\n",
       "                \"\\u5317\\u4eac\",\n",
       "                \"\\u9999\\u6e2f\",\n",
       "                \"\\u5e7f\\u5dde\",\n",
       "                \"\\u65e0\\u9521\",\n",
       "                \"\\u5e38\\u5dde\",\n",
       "                \"\\u82cf\\u5dde\",\n",
       "                \"\\u4e09\\u4e9a\",\n",
       "                \"\\u5357\\u4eac\"\n",
       "            ],\n",
       "            \"type\": \"category\"\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\",\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"rotate\": 0,\n",
       "                \"interval\": \"auto\",\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14,\n",
       "                    \"color\": \"#000\"\n",
       "                }\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"position\": null,\n",
       "            \"boundaryGap\": true,\n",
       "            \"min\": null,\n",
       "            \"max\": null,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"type\": \"value\"\n",
       "        }\n",
       "    ],\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_aa2f97b8fff44f54972ad87dc06105f4.setOption(option_aa2f97b8fff44f54972ad87dc06105f4);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.bar.Bar at 0x11f021208>"
      ]
     },
     "execution_count": 356,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import Bar\n",
    "\n",
    "bar = Bar(\"最近一个月售出门票Top10城市\", width = 700,height=500)\n",
    "bar.add(\"\", city_sale_top10.index, city_sale_top10.values, is_stack=True, \n",
    "       xaxis_label_textsize=18, yaxis_label_textsize=14, is_label_show=True,\n",
    "       xaxis_rotate=20)\n",
    "bar"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_final.groupby('fields.shortInfo')['fields.soldRecentNum'].sum().nlargest(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 347,
   "metadata": {},
   "outputs": [],
   "source": [
    "city_favor_count = data_final[(data_final['fields.itemTotalScore'] > 0)&\n",
    "                              (data_final['fields.comment'] > 30)\n",
    "                             ].groupby('fields.shortInfo')['fields.itemTotalScore'].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 349,
   "metadata": {},
   "outputs": [],
   "source": [
    "city_qual = list(city_favor_count[city_favor_count > 30].index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 366,
   "metadata": {},
   "outputs": [],
   "source": [
    "city_favor_top10 = data_final[(data_final['fields.itemTotalScore'] > 0)&\n",
    "                              (data_final['fields.comment'] > 30)&\n",
    "                              (data_final['fields.shortInfo'].isin(city_qual))\n",
    "                             ].groupby('fields.shortInfo')['fields.itemTotalScore'].mean().nlargest(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 369,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min', 'wordcloud': '/nbextensions/echarts/echarts-wordcloud.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"7cedd538cec0405188ffc4908717133f\" style=\"width:500px;height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts', 'wordcloud'], function(echarts) {\n",
       "        \n",
       "var myChart_7cedd538cec0405188ffc4908717133f = echarts.init(document.getElementById('7cedd538cec0405188ffc4908717133f'), null, {renderer: 'canvas'});\n",
       "var option_7cedd538cec0405188ffc4908717133f = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\",\n",
       "            \"subtext\": \"\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"color\": \"#000\",\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"color\": \"#aaa\",\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4e0b\\u8f7d\\u56fe\\u7247\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 2953661,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"formatter\": null,\n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#fff\",\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"wordCloud\",\n",
       "            \"name\": \"\",\n",
       "            \"shape\": \"circle\",\n",
       "            \"rotationRange\": [\n",
       "                -90,\n",
       "                90\n",
       "            ],\n",
       "            \"rotationStep\": 45,\n",
       "            \"girdSize\": 20,\n",
       "            \"sizeRange\": [\n",
       "                20,\n",
       "                80\n",
       "            ],\n",
       "            \"data\": [\n",
       "                {\n",
       "                    \"name\": \"\\u6b66\\u6c49\",\n",
       "                    \"value\": 19.48360655737701,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(43,105,112)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6d77\\u53e3\",\n",
       "                    \"value\": 19.476190476190496,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(147,40,57)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6fb3\\u95e8\",\n",
       "                    \"value\": 19.44660194174756,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(160,5,142)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u676d\\u5dde\",\n",
       "                    \"value\": 19.40243902439019,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(61,70,136)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u82cf\\u5dde\",\n",
       "                    \"value\": 19.37499999999997,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(4,124,35)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5e38\\u5dde\",\n",
       "                    \"value\": 19.36274509803919,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(33,59,143)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5927\\u8fde\",\n",
       "                    \"value\": 19.318181818181827,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(99,71,18)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5357\\u4eac\",\n",
       "                    \"value\": 19.30526315789472,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(157,127,80)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5317\\u4eac\",\n",
       "                    \"value\": 19.301507537688387,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(101,157,40)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u65e0\\u9521\",\n",
       "                    \"value\": 19.27586206896551,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(131,60,126)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9999\\u6e2f\",\n",
       "                    \"value\": 19.27038626609439,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(40,138,43)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u9ec4\\u5c71\",\n",
       "                    \"value\": 19.25000000000003,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(159,104,13)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u79e6\\u7687\\u5c9b\",\n",
       "                    \"value\": 19.250000000000007,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(84,58,100)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u73e0\\u6d77\",\n",
       "                    \"value\": 19.217948717948715,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(154,47,84)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5b81\\u6ce2\",\n",
       "                    \"value\": 19.173333333333325,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(137,148,135)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u897f\\u5b89\",\n",
       "                    \"value\": 19.13580246913579,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(47,159,116)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u5929\\u6d25\",\n",
       "                    \"value\": 19.13513513513515,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(159,11,28)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u54c8\\u5c14\\u6ee8\",\n",
       "                    \"value\": 19.11111111111112,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(103,25,14)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u6842\\u6797\",\n",
       "                    \"value\": 19.096969696969637,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(22,46,16)\"\n",
       "                        }\n",
       "                    }\n",
       "                },\n",
       "                {\n",
       "                    \"name\": \"\\u798f\\u5dde\",\n",
       "                    \"value\": 19.089552238805958,\n",
       "                    \"textStyle\": {\n",
       "                        \"normal\": {\n",
       "                            \"color\": \"rgb(82,47,58)\"\n",
       "                        }\n",
       "                    }\n",
       "                }\n",
       "            ]\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12,\n",
       "                \"color\": \"#333\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"backgroundColor\": \"#fff\",\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_7cedd538cec0405188ffc4908717133f.setOption(option_7cedd538cec0405188ffc4908717133f);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.wordcloud.WordCloud at 0x11e7a6ef0>"
      ]
     },
     "execution_count": 369,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts import WordCloud\n",
    "\n",
    "\n",
    "name, value = city_favor_top10.index, city_favor_top10.values*10-30\n",
    "wordcloud = WordCloud(width=500, height=500)\n",
    "wordcloud.add(\"\", name, value, word_size_range=[20, 80])\n",
    "wordcloud"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 3. 最热门的景点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 516,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fields.title</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>44567</th>\n",
       "      <td>上海迪士尼度假区</td>\n",
       "      <td>227123</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8162</th>\n",
       "      <td>灵隐飞来峰</td>\n",
       "      <td>119349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8285</th>\n",
       "      <td>【当天可订 官方品质】杭州西湖灵隐飞来峰（不含灵隐寺） 门票</td>\n",
       "      <td>117729</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46880</th>\n",
       "      <td>香港迪士尼乐园</td>\n",
       "      <td>75092</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42479</th>\n",
       "      <td>故宫博物院</td>\n",
       "      <td>50138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25585</th>\n",
       "      <td>广州长隆野生动物世界</td>\n",
       "      <td>41234</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29091</th>\n",
       "      <td>珠海长隆海洋王国</td>\n",
       "      <td>34822</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14184</th>\n",
       "      <td>九华山</td>\n",
       "      <td>29984</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44571</th>\n",
       "      <td>上海野生动物园</td>\n",
       "      <td>25642</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25587</th>\n",
       "      <td>广州长隆国际大马戏</td>\n",
       "      <td>25421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36476</th>\n",
       "      <td>东方明珠广播电视塔</td>\n",
       "      <td>24243</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10971</th>\n",
       "      <td>乌镇</td>\n",
       "      <td>19557</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         fields.title  fields.soldRecentNum\n",
       "44567                        上海迪士尼度假区                227123\n",
       "8162                            灵隐飞来峰                119349\n",
       "8285   【当天可订 官方品质】杭州西湖灵隐飞来峰（不含灵隐寺） 门票                117729\n",
       "46880                         香港迪士尼乐园                 75092\n",
       "42479                           故宫博物院                 50138\n",
       "25585                      广州长隆野生动物世界                 41234\n",
       "29091                        珠海长隆海洋王国                 34822\n",
       "14184                             九华山                 29984\n",
       "44571                         上海野生动物园                 25642\n",
       "25587                       广州长隆国际大马戏                 25421\n",
       "36476                       东方明珠广播电视塔                 24243\n",
       "10971                              乌镇                 19557"
      ]
     },
     "execution_count": 516,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_final.sort_values(by='fields.soldRecentNum', \n",
    "                      ascending=False)[:12][['fields.title', 'fields.soldRecentNum']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 524,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"2d0bdda7687e4c82997b1ecb2acc59a2\" style=\"width:700px;height:600px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_2d0bdda7687e4c82997b1ecb2acc59a2 = echarts.init(document.getElementById('2d0bdda7687e4c82997b1ecb2acc59a2'), null, {renderer: 'canvas'});\n",
       "var option_2d0bdda7687e4c82997b1ecb2acc59a2 = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u6700\\u70ed\\u95e8\\u768410\\u4e2a\\u666f\\u70b9\",\n",
       "            \"subtext\": \"\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"color\": \"#000\",\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"color\": \"#aaa\",\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4e0b\\u8f7d\\u56fe\\u7247\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 7239972,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"formatter\": null,\n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#fff\",\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\",\n",
       "            \"data\": [\n",
       "                237078,\n",
       "                227123,\n",
       "                75092,\n",
       "                66655,\n",
       "                50138,\n",
       "                34822,\n",
       "                29984,\n",
       "                25642,\n",
       "                24243,\n",
       "                19557\n",
       "            ],\n",
       "            \"stack\": \"stack_7239972\",\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#000\",\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": null\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": null,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#fff\",\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 7239972\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12,\n",
       "                \"color\": \"#333\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"backgroundColor\": \"#fff\",\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"name\": \"\",\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 25,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 16,\n",
       "                    \"color\": \"#000\"\n",
       "                }\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"position\": null,\n",
       "            \"boundaryGap\": true,\n",
       "            \"min\": null,\n",
       "            \"max\": null,\n",
       "            \"data\": [\n",
       "                \"\\u7075\\u9690\\u98de\\u6765\\u5cf0\",\n",
       "                \"\\u4e0a\\u6d77\\u8fea\\u58eb\\u5c3c\",\n",
       "                \"\\u9999\\u6e2f\\u8fea\\u58eb\\u5c3c\",\n",
       "                \"\\u5e7f\\u5dde\\u957f\\u9686\",\n",
       "                \"\\u6545\\u5bab\\u535a\\u7269\\u9662\",\n",
       "                \"\\u73e0\\u6d77\\u957f\\u9686\",\n",
       "                \"\\u4e5d\\u534e\\u5c71\",\n",
       "                \"\\u4e0a\\u6d77\\u91ce\\u751f\\u52a8\\u7269\\u56ed\",\n",
       "                \"\\u4e1c\\u65b9\\u660e\\u73e0\",\n",
       "                \"\\u4e4c\\u9547\"\n",
       "            ],\n",
       "            \"type\": \"category\"\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\",\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"rotate\": 0,\n",
       "                \"interval\": \"auto\",\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14,\n",
       "                    \"color\": \"#000\"\n",
       "                }\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"position\": null,\n",
       "            \"boundaryGap\": true,\n",
       "            \"min\": null,\n",
       "            \"max\": null,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"type\": \"value\"\n",
       "        }\n",
       "    ],\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_2d0bdda7687e4c82997b1ecb2acc59a2.setOption(option_2d0bdda7687e4c82997b1ecb2acc59a2);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.bar.Bar at 0x11f135f28>"
      ]
     },
     "execution_count": 524,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "most_popular = ['灵隐飞来峰', '上海迪士尼', '香港迪士尼', '广州长隆', '故宫博物院',\n",
    "               '珠海长隆', '九华山', '上海野生动物园', '东方明珠', '乌镇']\n",
    "most_popular_values = [119349+117729, 227123, 75092, 41234+25421, 50138,\n",
    "                      34822, 29984, 25642, 24243, 19557]\n",
    "\n",
    "bar = Bar(\"最热门的10个景点\", width = 700,height=600)\n",
    "bar.add(\"\", most_popular, most_popular_values, is_stack=True, \n",
    "       xaxis_label_textsize=16, yaxis_label_textsize=14, is_label_show=True,\n",
    "       xaxis_rotate=25)\n",
    "bar"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 4. 各省份的好评热门景点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 371,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>city</th>\n",
       "      <th>fields.comment</th>\n",
       "      <th>fields.discountPrice</th>\n",
       "      <th>fields.features</th>\n",
       "      <th>fields.itemId</th>\n",
       "      <th>fields.itemTotalScore</th>\n",
       "      <th>fields.latitude</th>\n",
       "      <th>fields.longitude</th>\n",
       "      <th>fields.price</th>\n",
       "      <th>fields.shortInfo</th>\n",
       "      <th>fields.sold365</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "      <th>fields.tagList</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>trip_main_busness_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>15648</th>\n",
       "      <td>黄山</td>\n",
       "      <td>1.0</td>\n",
       "      <td>78.0</td>\n",
       "      <td>17:00前可订今日票</td>\n",
       "      <td>543240295472</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>78.0</td>\n",
       "      <td>黄山</td>\n",
       "      <td>45.0</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>【免预约 随订随进】黄山齐云山自由家营地景区门票 体验票游玩票</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>710</th>\n",
       "      <td>秦皇岛</td>\n",
       "      <td>51.0</td>\n",
       "      <td>19.5</td>\n",
       "      <td>16:00前可订今日票</td>\n",
       "      <td>39243817566</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>19.5</td>\n",
       "      <td>秦皇岛</td>\n",
       "      <td>2139.0</td>\n",
       "      <td>21</td>\n",
       "      <td>None</td>\n",
       "      <td>山海关老龙头门票秦皇岛旅游景区官方折扣电子票自动发码</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      city  fields.comment  fields.discountPrice fields.features  \\\n",
       "15648   黄山             1.0                  78.0     17:00前可订今日票   \n",
       "710    秦皇岛            51.0                  19.5     16:00前可订今日票   \n",
       "\n",
       "       fields.itemId  fields.itemTotalScore  fields.latitude  \\\n",
       "15648   543240295472                    5.0              0.0   \n",
       "710      39243817566                    5.0              0.0   \n",
       "\n",
       "       fields.longitude  fields.price fields.shortInfo  fields.sold365  \\\n",
       "15648               0.0          78.0               黄山            45.0   \n",
       "710                 0.0          19.5              秦皇岛          2139.0   \n",
       "\n",
       "       fields.soldRecentNum fields.tagList                     fields.title  \\\n",
       "15648                     0           None  【免预约 随订随进】黄山齐云山自由家营地景区门票 体验票游玩票   \n",
       "710                      21           None       山海关老龙头门票秦皇岛旅游景区官方折扣电子票自动发码   \n",
       "\n",
       "      trip_main_busness_type  \n",
       "15648               vocation  \n",
       "710                 vocation  "
      ]
     },
     "execution_count": 371,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.sample(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 421,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_top1(data):\n",
    "    return data.head(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 438,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>省份</th>\n",
       "      <th>项目名</th>\n",
       "      <th>销售数量</th>\n",
       "      <th>评分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>上海市</td>\n",
       "      <td>✅上海迪士尼乐门票 上海迪士尼乐园门票1日票 迪斯尼</td>\n",
       "      <td>9022</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>云南省</td>\n",
       "      <td>昆明青鱼湾水上乐园门票 青鱼湾【现买现用·秒出票】一票通玩</td>\n",
       "      <td>543</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>内蒙古自治区</td>\n",
       "      <td>【超值体验】内蒙古旅游鄂尔多斯草原演绎套票</td>\n",
       "      <td>16</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>北京市</td>\n",
       "      <td>【官方直营】北京古北水镇国际旅游度假区全天门票-散客全票</td>\n",
       "      <td>4100</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>台湾</td>\n",
       "      <td>雄狮旅游 台湾台北国立故宫博物院门票二维码电子票儿童免票</td>\n",
       "      <td>123</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>吉林省</td>\n",
       "      <td>I【自动出票】吉林长春伪满皇宫博物院门票 博物馆门票</td>\n",
       "      <td>125</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>四川省</td>\n",
       "      <td>✅【即买即用】 成都熊猫基地门票 大熊猫繁育研地究基地大门票</td>\n",
       "      <td>5491</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>天津市</td>\n",
       "      <td>【官方门票】天津方特欢乐世界门票 刷身份证入园</td>\n",
       "      <td>481</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>宁夏回族自治区</td>\n",
       "      <td>l【当天可订】 宁夏银川镇北堡西部影视城大门票 华夏西部影城</td>\n",
       "      <td>351</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>安徽省</td>\n",
       "      <td>【当天可订】宏村门票 安徽黄山宏村优惠票 宏村团队 黄山旅游</td>\n",
       "      <td>3070</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>山东省</td>\n",
       "      <td>【免取票电子票】山东德州济南泉城海洋极地世界旅游景区景点门票</td>\n",
       "      <td>3613</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>山西省</td>\n",
       "      <td>大同云冈石窟大门票成人票</td>\n",
       "      <td>599</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>广东省</td>\n",
       "      <td>五一特惠 当天 广州长隆国际大马戏动物马戏团门票成人女士一等座</td>\n",
       "      <td>2919</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>【官方门票】南宁方特东盟神画乐园门票 1票畅玩东盟十国方特门票</td>\n",
       "      <td>759</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>新疆维吾尔自治区</td>\n",
       "      <td>【当天可定】新疆 乌鲁木齐 天山大峡谷 新疆旅游 天山大峡谷L</td>\n",
       "      <td>13</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>江苏省</td>\n",
       "      <td>【当天可订|自动出票】南京总统府景区门票南京总统府门票电子票</td>\n",
       "      <td>6924</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>江西省</td>\n",
       "      <td>江西 南昌 滕王阁门票 滕王阁门票+电子导览</td>\n",
       "      <td>630</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>河北省</td>\n",
       "      <td>清西陵景区|套票</td>\n",
       "      <td>216</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>河南省</td>\n",
       "      <td>【官方旗舰店】河南开封清明上河园/白天门票/大门票</td>\n",
       "      <td>3083</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>浙江省</td>\n",
       "      <td>【当天可订 官方品质】杭州西湖灵隐飞来峰（不含灵隐寺） 门票</td>\n",
       "      <td>117729</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>海南省</td>\n",
       "      <td>免抱佛脚随时出票三亚南山寺门票+电瓶车南海观音南山海南旅游</td>\n",
       "      <td>4080</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>湖北省</td>\n",
       "      <td>【官方旗舰店】武汉欢乐谷 成人/儿童/青少年/大学生票 全日票</td>\n",
       "      <td>1796</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>湖南省</td>\n",
       "      <td>【官方门票当日可定】株洲方特梦幻王国门票身份证入园极速出票</td>\n",
       "      <td>590</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>澳门</td>\n",
       "      <td>扫码即用澳门新濠影汇酒店8字摩天轮八字摩天轮电子门票旅游之星</td>\n",
       "      <td>1090</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>甘肃省</td>\n",
       "      <td>【官方】敦煌鸣沙山月牙泉门票 敦煌旅游景点景区成人电子门票</td>\n",
       "      <td>504</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>福建省</td>\n",
       "      <td>【官方旗舰店】菽庄花园门票成人票 厦门鼓浪屿景区景点门票飞猪</td>\n",
       "      <td>4576</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>西藏自治区</td>\n",
       "      <td>西藏拉萨旅游文成公主大型实景剧演出门票表演票市区游可选接送</td>\n",
       "      <td>279</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>贵州省</td>\n",
       "      <td>【官方预定】铜仁梵净山门票+含往返环保车+往返索道 贵州大门票</td>\n",
       "      <td>540</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>辽宁省</td>\n",
       "      <td>【四馆套票】辽宁大连圣亚海洋世界公园极地馆旅游景区景点门票</td>\n",
       "      <td>4049</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>重庆市</td>\n",
       "      <td>【赠10元餐券】重庆黑山谷门票 重庆万盛区黑山谷景区大门票HP</td>\n",
       "      <td>1108</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>陕西省</td>\n",
       "      <td>西安旅游 西安兵马俑博物馆门票 兵马俑门票兵马俑大门票秦始皇陵</td>\n",
       "      <td>5307</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>青海省</td>\n",
       "      <td>青海景点门票青藏高原野生动物园西宁野生动物园西藏动物园门票</td>\n",
       "      <td>52</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>香港</td>\n",
       "      <td>【当天可订】香港迪士尼三合一餐劵午餐+晚餐+小食香港迪士尼门票</td>\n",
       "      <td>1605</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>黑龙江省</td>\n",
       "      <td>【官方直营】哈尔滨极地馆大门票（跟着企鹅看表演）</td>\n",
       "      <td>159</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          省份                              项目名    销售数量   评分\n",
       "0        上海市       ✅上海迪士尼乐门票 上海迪士尼乐园门票1日票 迪斯尼    9022  5.0\n",
       "1        云南省    昆明青鱼湾水上乐园门票 青鱼湾【现买现用·秒出票】一票通玩     543  5.0\n",
       "2     内蒙古自治区            【超值体验】内蒙古旅游鄂尔多斯草原演绎套票      16  5.0\n",
       "3        北京市     【官方直营】北京古北水镇国际旅游度假区全天门票-散客全票    4100  5.0\n",
       "4         台湾     雄狮旅游 台湾台北国立故宫博物院门票二维码电子票儿童免票     123  5.0\n",
       "5        吉林省       I【自动出票】吉林长春伪满皇宫博物院门票 博物馆门票     125  5.0\n",
       "6        四川省   ✅【即买即用】 成都熊猫基地门票 大熊猫繁育研地究基地大门票    5491  5.0\n",
       "7        天津市          【官方门票】天津方特欢乐世界门票 刷身份证入园     481  5.0\n",
       "8    宁夏回族自治区   l【当天可订】 宁夏银川镇北堡西部影视城大门票 华夏西部影城     351  5.0\n",
       "9        安徽省   【当天可订】宏村门票 安徽黄山宏村优惠票 宏村团队 黄山旅游    3070  5.0\n",
       "10       山东省   【免取票电子票】山东德州济南泉城海洋极地世界旅游景区景点门票    3613  5.0\n",
       "11       山西省                     大同云冈石窟大门票成人票     599  5.0\n",
       "12       广东省  五一特惠 当天 广州长隆国际大马戏动物马戏团门票成人女士一等座    2919  5.0\n",
       "13   广西壮族自治区  【官方门票】南宁方特东盟神画乐园门票 1票畅玩东盟十国方特门票     759  5.0\n",
       "14  新疆维吾尔自治区  【当天可定】新疆 乌鲁木齐 天山大峡谷 新疆旅游 天山大峡谷L      13  5.0\n",
       "15       江苏省   【当天可订|自动出票】南京总统府景区门票南京总统府门票电子票    6924  5.0\n",
       "16       江西省           江西 南昌 滕王阁门票 滕王阁门票+电子导览     630  5.0\n",
       "17       河北省                         清西陵景区|套票     216  5.0\n",
       "18       河南省        【官方旗舰店】河南开封清明上河园/白天门票/大门票    3083  5.0\n",
       "19       浙江省   【当天可订 官方品质】杭州西湖灵隐飞来峰（不含灵隐寺） 门票  117729  5.0\n",
       "20       海南省    免抱佛脚随时出票三亚南山寺门票+电瓶车南海观音南山海南旅游    4080  5.0\n",
       "21       湖北省  【官方旗舰店】武汉欢乐谷 成人/儿童/青少年/大学生票 全日票    1796  5.0\n",
       "22       湖南省    【官方门票当日可定】株洲方特梦幻王国门票身份证入园极速出票     590  5.0\n",
       "23        澳门   扫码即用澳门新濠影汇酒店8字摩天轮八字摩天轮电子门票旅游之星    1090  5.0\n",
       "24       甘肃省    【官方】敦煌鸣沙山月牙泉门票 敦煌旅游景点景区成人电子门票     504  5.0\n",
       "25       福建省   【官方旗舰店】菽庄花园门票成人票 厦门鼓浪屿景区景点门票飞猪    4576  5.0\n",
       "26     西藏自治区    西藏拉萨旅游文成公主大型实景剧演出门票表演票市区游可选接送     279  5.0\n",
       "27       贵州省  【官方预定】铜仁梵净山门票+含往返环保车+往返索道 贵州大门票     540  5.0\n",
       "28       辽宁省    【四馆套票】辽宁大连圣亚海洋世界公园极地馆旅游景区景点门票    4049  5.0\n",
       "29       重庆市  【赠10元餐券】重庆黑山谷门票 重庆万盛区黑山谷景区大门票HP    1108  5.0\n",
       "30       陕西省  西安旅游 西安兵马俑博物馆门票 兵马俑门票兵马俑大门票秦始皇陵    5307  5.0\n",
       "31       青海省    青海景点门票青藏高原野生动物园西宁野生动物园西藏动物园门票      52  5.0\n",
       "32        香港  【当天可订】香港迪士尼三合一餐劵午餐+晚餐+小食香港迪士尼门票    1605  5.0\n",
       "33      黑龙江省         【官方直营】哈尔滨极地馆大门票（跟着企鹅看表演）     159  5.0"
      ]
     },
     "execution_count": 438,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "province_top1 = data_final.sort_values(by=['province', 'fields.itemTotalScore', 'fields.soldRecentNum'], \n",
    "                      ascending=False).groupby('province').apply(get_top1)[['fields.title', 'fields.soldRecentNum', 'fields.itemTotalScore']].reset_index()\n",
    "province_top1.drop(columns = 'level_1', inplace=True)\n",
    "province_top1.rename(columns={'province':'省份', 'fields.title':'项目名', \n",
    "                             'fields.soldRecentNum':'销售数量', 'fields.itemTotalScore':'评分'}, \n",
    "                    inplace=True)\n",
    "province_top1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 525,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>省份</th>\n",
       "      <th>项目名</th>\n",
       "      <th>销售数量</th>\n",
       "      <th>评分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>浙江省</td>\n",
       "      <td>【当天可订 官方品质】杭州西湖灵隐飞来峰（不含灵隐寺） 门票</td>\n",
       "      <td>117729</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>上海市</td>\n",
       "      <td>✅上海迪士尼乐门票 上海迪士尼乐园门票1日票 迪斯尼</td>\n",
       "      <td>9022</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>江苏省</td>\n",
       "      <td>【当天可订|自动出票】南京总统府景区门票南京总统府门票电子票</td>\n",
       "      <td>6924</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>四川省</td>\n",
       "      <td>✅【即买即用】 成都熊猫基地门票 大熊猫繁育研地究基地大门票</td>\n",
       "      <td>5491</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>陕西省</td>\n",
       "      <td>西安旅游 西安兵马俑博物馆门票 兵马俑门票兵马俑大门票秦始皇陵</td>\n",
       "      <td>5307</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>福建省</td>\n",
       "      <td>【官方旗舰店】菽庄花园门票成人票 厦门鼓浪屿景区景点门票飞猪</td>\n",
       "      <td>4576</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>北京市</td>\n",
       "      <td>【官方直营】北京古北水镇国际旅游度假区全天门票-散客全票</td>\n",
       "      <td>4100</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>海南省</td>\n",
       "      <td>免抱佛脚随时出票三亚南山寺门票+电瓶车南海观音南山海南旅游</td>\n",
       "      <td>4080</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>辽宁省</td>\n",
       "      <td>【四馆套票】辽宁大连圣亚海洋世界公园极地馆旅游景区景点门票</td>\n",
       "      <td>4049</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>山东省</td>\n",
       "      <td>【免取票电子票】山东德州济南泉城海洋极地世界旅游景区景点门票</td>\n",
       "      <td>3613</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>河南省</td>\n",
       "      <td>【官方旗舰店】河南开封清明上河园/白天门票/大门票</td>\n",
       "      <td>3083</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>安徽省</td>\n",
       "      <td>【当天可订】宏村门票 安徽黄山宏村优惠票 宏村团队 黄山旅游</td>\n",
       "      <td>3070</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>广东省</td>\n",
       "      <td>五一特惠 当天 广州长隆国际大马戏动物马戏团门票成人女士一等座</td>\n",
       "      <td>2919</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>湖北省</td>\n",
       "      <td>【官方旗舰店】武汉欢乐谷 成人/儿童/青少年/大学生票 全日票</td>\n",
       "      <td>1796</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>香港</td>\n",
       "      <td>【当天可订】香港迪士尼三合一餐劵午餐+晚餐+小食香港迪士尼门票</td>\n",
       "      <td>1605</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>重庆市</td>\n",
       "      <td>【赠10元餐券】重庆黑山谷门票 重庆万盛区黑山谷景区大门票HP</td>\n",
       "      <td>1108</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>澳门</td>\n",
       "      <td>扫码即用澳门新濠影汇酒店8字摩天轮八字摩天轮电子门票旅游之星</td>\n",
       "      <td>1090</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>【官方门票】南宁方特东盟神画乐园门票 1票畅玩东盟十国方特门票</td>\n",
       "      <td>759</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>江西省</td>\n",
       "      <td>江西 南昌 滕王阁门票 滕王阁门票+电子导览</td>\n",
       "      <td>630</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>山西省</td>\n",
       "      <td>大同云冈石窟大门票成人票</td>\n",
       "      <td>599</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>湖南省</td>\n",
       "      <td>【官方门票当日可定】株洲方特梦幻王国门票身份证入园极速出票</td>\n",
       "      <td>590</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>云南省</td>\n",
       "      <td>昆明青鱼湾水上乐园门票 青鱼湾【现买现用·秒出票】一票通玩</td>\n",
       "      <td>543</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>贵州省</td>\n",
       "      <td>【官方预定】铜仁梵净山门票+含往返环保车+往返索道 贵州大门票</td>\n",
       "      <td>540</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>甘肃省</td>\n",
       "      <td>【官方】敦煌鸣沙山月牙泉门票 敦煌旅游景点景区成人电子门票</td>\n",
       "      <td>504</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>天津市</td>\n",
       "      <td>【官方门票】天津方特欢乐世界门票 刷身份证入园</td>\n",
       "      <td>481</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>宁夏回族自治区</td>\n",
       "      <td>l【当天可订】 宁夏银川镇北堡西部影视城大门票 华夏西部影城</td>\n",
       "      <td>351</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>西藏自治区</td>\n",
       "      <td>西藏拉萨旅游文成公主大型实景剧演出门票表演票市区游可选接送</td>\n",
       "      <td>279</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>河北省</td>\n",
       "      <td>清西陵景区|套票</td>\n",
       "      <td>216</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>黑龙江省</td>\n",
       "      <td>【官方直营】哈尔滨极地馆大门票（跟着企鹅看表演）</td>\n",
       "      <td>159</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>吉林省</td>\n",
       "      <td>I【自动出票】吉林长春伪满皇宫博物院门票 博物馆门票</td>\n",
       "      <td>125</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>台湾</td>\n",
       "      <td>雄狮旅游 台湾台北国立故宫博物院门票二维码电子票儿童免票</td>\n",
       "      <td>123</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>青海省</td>\n",
       "      <td>青海景点门票青藏高原野生动物园西宁野生动物园西藏动物园门票</td>\n",
       "      <td>52</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>内蒙古自治区</td>\n",
       "      <td>【超值体验】内蒙古旅游鄂尔多斯草原演绎套票</td>\n",
       "      <td>16</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>新疆维吾尔自治区</td>\n",
       "      <td>【当天可定】新疆 乌鲁木齐 天山大峡谷 新疆旅游 天山大峡谷L</td>\n",
       "      <td>13</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          省份                              项目名    销售数量   评分\n",
       "19       浙江省   【当天可订 官方品质】杭州西湖灵隐飞来峰（不含灵隐寺） 门票  117729  5.0\n",
       "0        上海市       ✅上海迪士尼乐门票 上海迪士尼乐园门票1日票 迪斯尼    9022  5.0\n",
       "15       江苏省   【当天可订|自动出票】南京总统府景区门票南京总统府门票电子票    6924  5.0\n",
       "6        四川省   ✅【即买即用】 成都熊猫基地门票 大熊猫繁育研地究基地大门票    5491  5.0\n",
       "30       陕西省  西安旅游 西安兵马俑博物馆门票 兵马俑门票兵马俑大门票秦始皇陵    5307  5.0\n",
       "25       福建省   【官方旗舰店】菽庄花园门票成人票 厦门鼓浪屿景区景点门票飞猪    4576  5.0\n",
       "3        北京市     【官方直营】北京古北水镇国际旅游度假区全天门票-散客全票    4100  5.0\n",
       "20       海南省    免抱佛脚随时出票三亚南山寺门票+电瓶车南海观音南山海南旅游    4080  5.0\n",
       "28       辽宁省    【四馆套票】辽宁大连圣亚海洋世界公园极地馆旅游景区景点门票    4049  5.0\n",
       "10       山东省   【免取票电子票】山东德州济南泉城海洋极地世界旅游景区景点门票    3613  5.0\n",
       "18       河南省        【官方旗舰店】河南开封清明上河园/白天门票/大门票    3083  5.0\n",
       "9        安徽省   【当天可订】宏村门票 安徽黄山宏村优惠票 宏村团队 黄山旅游    3070  5.0\n",
       "12       广东省  五一特惠 当天 广州长隆国际大马戏动物马戏团门票成人女士一等座    2919  5.0\n",
       "21       湖北省  【官方旗舰店】武汉欢乐谷 成人/儿童/青少年/大学生票 全日票    1796  5.0\n",
       "32        香港  【当天可订】香港迪士尼三合一餐劵午餐+晚餐+小食香港迪士尼门票    1605  5.0\n",
       "29       重庆市  【赠10元餐券】重庆黑山谷门票 重庆万盛区黑山谷景区大门票HP    1108  5.0\n",
       "23        澳门   扫码即用澳门新濠影汇酒店8字摩天轮八字摩天轮电子门票旅游之星    1090  5.0\n",
       "13   广西壮族自治区  【官方门票】南宁方特东盟神画乐园门票 1票畅玩东盟十国方特门票     759  5.0\n",
       "16       江西省           江西 南昌 滕王阁门票 滕王阁门票+电子导览     630  5.0\n",
       "11       山西省                     大同云冈石窟大门票成人票     599  5.0\n",
       "22       湖南省    【官方门票当日可定】株洲方特梦幻王国门票身份证入园极速出票     590  5.0\n",
       "1        云南省    昆明青鱼湾水上乐园门票 青鱼湾【现买现用·秒出票】一票通玩     543  5.0\n",
       "27       贵州省  【官方预定】铜仁梵净山门票+含往返环保车+往返索道 贵州大门票     540  5.0\n",
       "24       甘肃省    【官方】敦煌鸣沙山月牙泉门票 敦煌旅游景点景区成人电子门票     504  5.0\n",
       "7        天津市          【官方门票】天津方特欢乐世界门票 刷身份证入园     481  5.0\n",
       "8    宁夏回族自治区   l【当天可订】 宁夏银川镇北堡西部影视城大门票 华夏西部影城     351  5.0\n",
       "26     西藏自治区    西藏拉萨旅游文成公主大型实景剧演出门票表演票市区游可选接送     279  5.0\n",
       "17       河北省                         清西陵景区|套票     216  5.0\n",
       "33      黑龙江省         【官方直营】哈尔滨极地馆大门票（跟着企鹅看表演）     159  5.0\n",
       "5        吉林省       I【自动出票】吉林长春伪满皇宫博物院门票 博物馆门票     125  5.0\n",
       "4         台湾     雄狮旅游 台湾台北国立故宫博物院门票二维码电子票儿童免票     123  5.0\n",
       "31       青海省    青海景点门票青藏高原野生动物园西宁野生动物园西藏动物园门票      52  5.0\n",
       "2     内蒙古自治区            【超值体验】内蒙古旅游鄂尔多斯草原演绎套票      16  5.0\n",
       "14  新疆维吾尔自治区  【当天可定】新疆 乌鲁木齐 天山大峡谷 新疆旅游 天山大峡谷L      13  5.0"
      ]
     },
     "execution_count": 525,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "province_top1.sort_values(by='销售数量', ascending=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 5. 热门但是评分不太高的景点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 452,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fields.shortInfo</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "      <th>fields.itemTotalScore</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2545</th>\n",
       "      <td>大连</td>\n",
       "      <td>【领券立减】大连二〇三樱花园大门票旅顺203樱花成人票扫码入园</td>\n",
       "      <td>118</td>\n",
       "      <td>4.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7124</th>\n",
       "      <td>无锡</td>\n",
       "      <td>【当天可定】无锡善卷洞门票善卷洞含游船联票大门票成人电子票</td>\n",
       "      <td>760</td>\n",
       "      <td>4.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8317</th>\n",
       "      <td>杭州</td>\n",
       "      <td>浙江杭州临安风之谷景区门票 户外昌化风之谷门票 杭州接送跟车</td>\n",
       "      <td>199</td>\n",
       "      <td>4.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22782</th>\n",
       "      <td>武汉</td>\n",
       "      <td>【汉口粤汉码头登船】武汉两江游览船票B线（不含餐）夜游长江游</td>\n",
       "      <td>109</td>\n",
       "      <td>4.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26939</th>\n",
       "      <td>深圳</td>\n",
       "      <td>ZY【当天可定即定即用】深圳观澜山水田园娱乐套票A 含景区大门票</td>\n",
       "      <td>155</td>\n",
       "      <td>3.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29856</th>\n",
       "      <td>佛山</td>\n",
       "      <td>顺德长鹿农庄门票 休博园 大门票+游乐金+动物园 单人票/双人票</td>\n",
       "      <td>1001</td>\n",
       "      <td>4.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29877</th>\n",
       "      <td>佛山</td>\n",
       "      <td>长鹿农庄门票休博园大门票 套票动物园2大2小（不含矿洞海洋馆）</td>\n",
       "      <td>210</td>\n",
       "      <td>4.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40353</th>\n",
       "      <td>西安</td>\n",
       "      <td>陕西 西安 西安城墙景区 大门票+电子导览</td>\n",
       "      <td>221</td>\n",
       "      <td>4.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42576</th>\n",
       "      <td>北京</td>\n",
       "      <td>北京昌平第七届北京农业嘉年华大门票 农业嘉年华门票 成人票</td>\n",
       "      <td>112</td>\n",
       "      <td>4.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46919</th>\n",
       "      <td>香港</td>\n",
       "      <td>Dm香港迪士尼乐园门票1日迪斯尼香港旅游自由行景点电子票不刷单</td>\n",
       "      <td>261</td>\n",
       "      <td>4.3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      fields.shortInfo                      fields.title  \\\n",
       "2545                大连   【领券立减】大连二〇三樱花园大门票旅顺203樱花成人票扫码入园   \n",
       "7124                无锡     【当天可定】无锡善卷洞门票善卷洞含游船联票大门票成人电子票   \n",
       "8317                杭州    浙江杭州临安风之谷景区门票 户外昌化风之谷门票 杭州接送跟车   \n",
       "22782               武汉    【汉口粤汉码头登船】武汉两江游览船票B线（不含餐）夜游长江游   \n",
       "26939               深圳  ZY【当天可定即定即用】深圳观澜山水田园娱乐套票A 含景区大门票   \n",
       "29856               佛山  顺德长鹿农庄门票 休博园 大门票+游乐金+动物园 单人票/双人票   \n",
       "29877               佛山   长鹿农庄门票休博园大门票 套票动物园2大2小（不含矿洞海洋馆）   \n",
       "40353               西安             陕西 西安 西安城墙景区 大门票+电子导览   \n",
       "42576               北京     北京昌平第七届北京农业嘉年华大门票 农业嘉年华门票 成人票   \n",
       "46919               香港   Dm香港迪士尼乐园门票1日迪斯尼香港旅游自由行景点电子票不刷单   \n",
       "\n",
       "       fields.soldRecentNum  fields.itemTotalScore  \n",
       "2545                    118                    4.3  \n",
       "7124                    760                    4.2  \n",
       "8317                    199                    4.3  \n",
       "22782                   109                    4.3  \n",
       "26939                   155                    3.8  \n",
       "29856                  1001                    4.4  \n",
       "29877                   210                    4.3  \n",
       "40353                   221                    4.4  \n",
       "42576                   112                    4.4  \n",
       "46919                   261                    4.3  "
      ]
     },
     "execution_count": 452,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_final[(data_final['fields.soldRecentNum']>100)&\n",
    "          (data_final['fields.itemTotalScore']<4.5)&\n",
    "          (data_final['fields.itemTotalScore']>0)][['fields.shortInfo', 'fields.title', 'fields.soldRecentNum', 'fields.itemTotalScore']]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 6. 打折力度最大的景点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 453,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>city</th>\n",
       "      <th>fields.comment</th>\n",
       "      <th>fields.discountPrice</th>\n",
       "      <th>fields.features</th>\n",
       "      <th>fields.itemId</th>\n",
       "      <th>fields.itemTotalScore</th>\n",
       "      <th>fields.latitude</th>\n",
       "      <th>fields.longitude</th>\n",
       "      <th>fields.price</th>\n",
       "      <th>fields.shortInfo</th>\n",
       "      <th>fields.sold365</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "      <th>fields.tagList</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>trip_main_busness_type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>30023</th>\n",
       "      <td>广州</td>\n",
       "      <td>1.0</td>\n",
       "      <td>88.0</td>\n",
       "      <td>18:00前可订今日票</td>\n",
       "      <td>43133513613</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>88.0</td>\n",
       "      <td>广州</td>\n",
       "      <td>77.0</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>广州珠江夜游中恒集团号 二楼VIP座 门票船票/大沙头码头</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52777</th>\n",
       "      <td>重庆</td>\n",
       "      <td>0.0</td>\n",
       "      <td>111.0</td>\n",
       "      <td>最早可定明日票</td>\n",
       "      <td>592703467097</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>111.0</td>\n",
       "      <td>重庆</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>重庆武隆喀斯特/龙水峡地缝票/含仙女镇武隆游客中心往返的中转车</td>\n",
       "      <td>vocation</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      city  fields.comment  fields.discountPrice fields.features  \\\n",
       "30023   广州             1.0                  88.0     18:00前可订今日票   \n",
       "52777   重庆             0.0                 111.0         最早可定明日票   \n",
       "\n",
       "       fields.itemId  fields.itemTotalScore  fields.latitude  \\\n",
       "30023    43133513613                    5.0              0.0   \n",
       "52777   592703467097                    0.0              0.0   \n",
       "\n",
       "       fields.longitude  fields.price fields.shortInfo  fields.sold365  \\\n",
       "30023               0.0          88.0               广州            77.0   \n",
       "52777               0.0         111.0               重庆             NaN   \n",
       "\n",
       "       fields.soldRecentNum fields.tagList                     fields.title  \\\n",
       "30023                     0           None    广州珠江夜游中恒集团号 二楼VIP座 门票船票/大沙头码头   \n",
       "52777                     0           None  重庆武隆喀斯特/龙水峡地缝票/含仙女镇武隆游客中心往返的中转车   \n",
       "\n",
       "      trip_main_busness_type  \n",
       "30023               vocation  \n",
       "52777               vocation  "
      ]
     },
     "execution_count": 453,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.sample(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 477,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_final['discount'] = np.round((1 - (data_final['fields.price'] - \n",
    "                               data_final['fields.discountPrice'])/data_final['fields.price'])*10, 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 486,
   "metadata": {},
   "outputs": [],
   "source": [
    "dis_data = data_final.sort_values(by='discount')[['fields.discountPrice',\n",
    "                                                            'fields.price',\n",
    "                                                            'discount',\n",
    "                                                            'fields.title',\n",
    "                                                            'fields.shortInfo']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 487,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fields.discountPrice</th>\n",
       "      <th>fields.price</th>\n",
       "      <th>discount</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>fields.shortInfo</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>28979</th>\n",
       "      <td>13.5</td>\n",
       "      <td>50.00</td>\n",
       "      <td>2.7</td>\n",
       "      <td>ZM【当天可定】广东 东莞南社明清古村落 成人儿童老人观光大门票</td>\n",
       "      <td>东莞</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22713</th>\n",
       "      <td>180.0</td>\n",
       "      <td>630.00</td>\n",
       "      <td>2.9</td>\n",
       "      <td>【大学生3人特惠】武汉海昌极地海洋公园门票 海洋世界含萌宠乐园</td>\n",
       "      <td>武汉</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29456</th>\n",
       "      <td>598.0</td>\n",
       "      <td>1980.00</td>\n",
       "      <td>3.0</td>\n",
       "      <td>【598元/10次卡】超值钜惠 珠海海泉湾海洋温泉10次卡 可4人使用</td>\n",
       "      <td>珠海</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37355</th>\n",
       "      <td>18.0</td>\n",
       "      <td>53.10</td>\n",
       "      <td>3.4</td>\n",
       "      <td>【双人特价 电子票】成都大熊猫基地门票成都大熊猫繁育研究基地</td>\n",
       "      <td>成都</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27530</th>\n",
       "      <td>34.5</td>\n",
       "      <td>100.00</td>\n",
       "      <td>3.4</td>\n",
       "      <td>ZY【提前1小时下单】广东 清远田野绿世界 成人儿童老人大门票</td>\n",
       "      <td>清远</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30308</th>\n",
       "      <td>36.0</td>\n",
       "      <td>100.00</td>\n",
       "      <td>3.6</td>\n",
       "      <td>ZM【当天可定】广东 阳江闸坡大角湾景区 成人1日景区大门票</td>\n",
       "      <td>阳江</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26931</th>\n",
       "      <td>60.0</td>\n",
       "      <td>166.50</td>\n",
       "      <td>3.6</td>\n",
       "      <td>即买即用 索道+缆车】 深圳东部华侨城大侠谷门票 大峡谷亲子家庭</td>\n",
       "      <td>深圳</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1004</th>\n",
       "      <td>49.9</td>\n",
       "      <td>135.00</td>\n",
       "      <td>3.7</td>\n",
       "      <td>当日可订 河北 秦皇岛 沙雕海洋乐园门票 沙雕大世界大门票</td>\n",
       "      <td>秦皇岛</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30549</th>\n",
       "      <td>20.0</td>\n",
       "      <td>52.99</td>\n",
       "      <td>3.8</td>\n",
       "      <td>【 即买即用】南宁园博园门票 第十二届园博会园博园门票</td>\n",
       "      <td>南宁</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30541</th>\n",
       "      <td>21.4</td>\n",
       "      <td>55.00</td>\n",
       "      <td>3.9</td>\n",
       "      <td>【 即买即用】南宁园博园门票 第十二届园博会园博园门票</td>\n",
       "      <td>南宁</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30426</th>\n",
       "      <td>40.0</td>\n",
       "      <td>100.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>ZM【当天可定】提前1小时下单 广东茂名浪漫海岸成人儿童情侣门票</td>\n",
       "      <td>茂名</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28929</th>\n",
       "      <td>24.0</td>\n",
       "      <td>60.00</td>\n",
       "      <td>4.0</td>\n",
       "      <td>【当天可定 即定即用】 广东 东莞梦幻百花洲 成人儿童老人大门票</td>\n",
       "      <td>东莞</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42044</th>\n",
       "      <td>138.0</td>\n",
       "      <td>336.00</td>\n",
       "      <td>4.1</td>\n",
       "      <td>银川天山海世界.黄河明珠五一特惠双人票</td>\n",
       "      <td>银川</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6922</th>\n",
       "      <td>35.0</td>\n",
       "      <td>83.00</td>\n",
       "      <td>4.2</td>\n",
       "      <td>【当天可订】江苏无锡鼋头渚门票+客渡船门票（含园内公交车）</td>\n",
       "      <td>无锡</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>313</th>\n",
       "      <td>69.9</td>\n",
       "      <td>168.00</td>\n",
       "      <td>4.2</td>\n",
       "      <td>【官方旗舰店】石家庄天山海世界69.9元五一特惠票</td>\n",
       "      <td>石家庄</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       fields.discountPrice  fields.price  discount  \\\n",
       "28979                  13.5         50.00       2.7   \n",
       "22713                 180.0        630.00       2.9   \n",
       "29456                 598.0       1980.00       3.0   \n",
       "37355                  18.0         53.10       3.4   \n",
       "27530                  34.5        100.00       3.4   \n",
       "30308                  36.0        100.00       3.6   \n",
       "26931                  60.0        166.50       3.6   \n",
       "1004                   49.9        135.00       3.7   \n",
       "30549                  20.0         52.99       3.8   \n",
       "30541                  21.4         55.00       3.9   \n",
       "30426                  40.0        100.00       4.0   \n",
       "28929                  24.0         60.00       4.0   \n",
       "42044                 138.0        336.00       4.1   \n",
       "6922                   35.0         83.00       4.2   \n",
       "313                    69.9        168.00       4.2   \n",
       "\n",
       "                              fields.title fields.shortInfo  \n",
       "28979     ZM【当天可定】广东 东莞南社明清古村落 成人儿童老人观光大门票               东莞  \n",
       "22713      【大学生3人特惠】武汉海昌极地海洋公园门票 海洋世界含萌宠乐园               武汉  \n",
       "29456  【598元/10次卡】超值钜惠 珠海海泉湾海洋温泉10次卡 可4人使用               珠海  \n",
       "37355       【双人特价 电子票】成都大熊猫基地门票成都大熊猫繁育研究基地               成都  \n",
       "27530      ZY【提前1小时下单】广东 清远田野绿世界 成人儿童老人大门票               清远  \n",
       "30308       ZM【当天可定】广东 阳江闸坡大角湾景区 成人1日景区大门票               阳江  \n",
       "26931     即买即用 索道+缆车】 深圳东部华侨城大侠谷门票 大峡谷亲子家庭               深圳  \n",
       "1004         当日可订 河北 秦皇岛 沙雕海洋乐园门票 沙雕大世界大门票              秦皇岛  \n",
       "30549          【 即买即用】南宁园博园门票 第十二届园博会园博园门票               南宁  \n",
       "30541          【 即买即用】南宁园博园门票 第十二届园博会园博园门票               南宁  \n",
       "30426     ZM【当天可定】提前1小时下单 广东茂名浪漫海岸成人儿童情侣门票               茂名  \n",
       "28929     【当天可定 即定即用】 广东 东莞梦幻百花洲 成人儿童老人大门票               东莞  \n",
       "42044                  银川天山海世界.黄河明珠五一特惠双人票               银川  \n",
       "6922         【当天可订】江苏无锡鼋头渚门票+客渡船门票（含园内公交车）               无锡  \n",
       "313              【官方旗舰店】石家庄天山海世界69.9元五一特惠票              石家庄  "
      ]
     },
     "execution_count": 487,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dis_data.head(15)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 545,
   "metadata": {},
   "outputs": [],
   "source": [
    "dis_data[dis_data['discount']<7].to_csv('discount.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 540,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0, 150)"
      ]
     },
     "execution_count": 540,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEcCAYAAAA2g5hwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3X1cjff/B/BXpRs6Z0lam5ZwDBPS\nJIvITaEZhmGTTLkp5CZyE22zjS+am5SbmGLDxoz5GhnabMN324Myc1OZtGq++KaYbnQ6p67fH37V\nzirXybk658jr+Xh4PPS5Pp/P9b6uR66X67rOuS4TQRAEEBERPYKpoQsgIiLjx7AgIiJRDAsiIhLF\nsCAiIlEMCyIiEsWwICIiUXUOi9TUVLi4uODWrVsa7b6+vmjfvn21P/n5+ZV9Ll68iICAALi5ucHL\nywtr166FSqXSfSuIiKheNapL54yMDAQHB0OtVmu0FxUVIScnB/PmzYOHh4fGsmeeeQYAkJWVhYkT\nJ8LNzQ3R0dHIyMjAunXrUFhYiHfffVfHzSAiovqkVVio1Wrs3bsXa9asgbm5ebXl6enpEAQBAwYM\ngEKhqHGOrVu3Qi6XY9OmTbCwsIC3tzesrKywbNkyBAcHw8HBQbctISKieqPVZajk5GSsXr0aQUFB\nCA8Pr7Y8NTUVVlZWaNWqVa1znDlzBv369YOFhUVl2+DBg1FWVobTp0/XvXIiItIbrcJCoVAgKS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\nCyG/GHKZlU5zmJs30mmOuo6vqa+uNUgxhz5raGyp+6Fe8rBITEzEokWL0KpVK2zbtg22trYAgHbt\n2lXr6+TkVHnWURd5eYUoLxckqfdJZm8vR25ugaHLMAr1uS+KlWoUFJboNkexErllZRJV9GjGvi9U\nKt3mqMt4ucyqxr661iDFHPqsoUxtrtN6AIkvQ23fvh1z585F165dsXv3bjz77LMAHn5a6uDBgzh3\n7ly1MSUlJZWBQkRExkmysNi3bx9WrlwJPz8/bNu2DXJ51WmwiYkJ4uPj8a9//Qvl5VUXby9fvozs\n7Gx4eHhIVQYREdUDSS5D5eXlYfny5XB0dIS/vz+uXLmisbxly5YIDQ3FrFmzEB4ejlGjRuG///0v\n1q9fj5deegnDhw+XogwiIqonkoTFqVOn8ODBA9y4cQP+/v7VlkdFRWH48OHYuHEj4uLiEBoaCisr\nK/j6+mLu3LkwMzOTogwiIqonkoTF66+/jtdff120n4+PD3x8fKRYJRER6RGfOktERKIYFkREJIph\nQUREohgWREQkimFBRESi6uXZUERkfNTlgFKl1mkOPmXn6cWwIHpKKFVqnE29rdMcru3sJaqGnjS8\nDEVERKIYFkREJIqXoYj0wMTUBEVK3e4XmDdqBJVafA4hvxjFNayL9xtIFwwLIj1Qqspw4apub4R0\nbWev1Ry1vcOB9xtIF7wMRUREohgWREQkimFBRESiGBZERCSKYUFERKIYFkREJIphQUREohgWREQk\nimFBRESiGBZERCSKj/sgo6btOxhqex4SoP0zlWrDZyoRMSzIyGn7DobanocEaP9MpdrwmUpEvAxF\nRERa0PuZxeHDh7F582bk5OTA0dERwcHBeP311/VdBukBX+NJ1HDoNSwSExMRHh6Ot99+G15eXkhK\nSsLChQthZWWFwYMH67MU0oKuB/tyAUhO42s8iRoCvYbFunXr4Ofnh4iICABA79698ddff2H9+vUM\nCyOk6zubeaAnajj0ds8iJycH2dnZGDhwoEb7oEGDcP36deTk5OirFCIiqiO9nVlcv34dANC6dWuN\ndmdnZwBAZmYmnJyctJrL1NRE2uKeYPW5Lx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ceIEfv75ZwQGBqJt\n27YAHt6w3rJlC8LCwjBx4kQolUrs3r0bDg4Oj/VNbFtbWwDAoUOHIAgCRowYgUaN+E+bpMXfKGpQ\n+vXrhy1btiA2NhZr166Fg4MDli9fjt27d9c65sMPP4STkxOOHDmCI0eOoHHjxvD09ERYWFjlzWU7\nOzvs3bsXa9aswZ49e1BaWooOHTogISEBnp6eAB7eWP/iiy8QHR2NPXv2oKSkBAqFAsuXL8cbb7xR\nub4OHTogOjoaGzduRFRUFJ5//nlMmTIFJSUliIqKqvM2KxQKBAQE4MCBA7h48SJ69OhR7SY/ka5M\nhEfdmSMiIgLvWRARkRYYFkREJIphQUREohgWREQkimFBRESiGBZERCSKYUFERKIYFkREJIphQURE\nohgWREQk6v8ACTDnNKuYeOEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x11f6855f8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.set(font_scale=1.5)\n",
    "g = sns.distplot(dis_data['discount'], kde=False)\n",
    "g.set_xlim(0, 10)\n",
    "g.set_ylim(0, 150)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 493,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "fields.shortInfo\n",
       "桂林    16\n",
       "上海    12\n",
       "香港    10\n",
       "三亚     7\n",
       "深圳     6\n",
       "Name: fields.title, dtype: int64"
      ]
     },
     "execution_count": 493,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dis_data[dis_data['discount']<7].groupby('fields.shortInfo')['fields.title'].count().nlargest(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 7. 各级别景区的门票价格"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 495,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>city</th>\n",
       "      <th>fields.comment</th>\n",
       "      <th>fields.discountPrice</th>\n",
       "      <th>fields.features</th>\n",
       "      <th>fields.itemId</th>\n",
       "      <th>fields.itemTotalScore</th>\n",
       "      <th>fields.latitude</th>\n",
       "      <th>fields.longitude</th>\n",
       "      <th>fields.price</th>\n",
       "      <th>fields.shortInfo</th>\n",
       "      <th>fields.sold365</th>\n",
       "      <th>fields.soldRecentNum</th>\n",
       "      <th>fields.tagList</th>\n",
       "      <th>fields.title</th>\n",
       "      <th>trip_main_busness_type</th>\n",
       "      <th>province</th>\n",
       "      <th>discount</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>47863</th>\n",
       "      <td>澳门</td>\n",
       "      <td>43.0</td>\n",
       "      <td>81.0</td>\n",
       "      <td>平均2分钟出票</td>\n",
       "      <td>581212914850</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>81.0</td>\n",
       "      <td>澳门</td>\n",
       "      <td>347.0</td>\n",
       "      <td>47</td>\n",
       "      <td>None</td>\n",
       "      <td>即订即用●澳门威尼斯人酒店贡多拉船船票 威尼斯人贡多拉游船票</td>\n",
       "      <td>vocation</td>\n",
       "      <td>澳门</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46474</th>\n",
       "      <td>重庆</td>\n",
       "      <td>0.0</td>\n",
       "      <td>92.0</td>\n",
       "      <td>15:00前可订今日票</td>\n",
       "      <td>588002298859</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>92.0</td>\n",
       "      <td>重庆</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>蘑菇总动员入园游览票+蘑菇房VR体验2项成人套票（及时入园）</td>\n",
       "      <td>vocation</td>\n",
       "      <td>重庆市</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41253</th>\n",
       "      <td>宝鸡</td>\n",
       "      <td>0.0</td>\n",
       "      <td>288.0</td>\n",
       "      <td>14:00前可订今日票</td>\n",
       "      <td>592644497614</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>288.0</td>\n",
       "      <td>宝鸡</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>宝鸡太白山国家森林公园门票+太白山尚境温泉门票 西安旅游门票</td>\n",
       "      <td>vocation</td>\n",
       "      <td>陕西省</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4947</th>\n",
       "      <td>徐州</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.0</td>\n",
       "      <td>16:30前可订今日票</td>\n",
       "      <td>591338865284</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>66.0</td>\n",
       "      <td>徐州</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>None</td>\n",
       "      <td>徐州新沂窑湾古镇门票 窑湾古镇成人票电子票</td>\n",
       "      <td>vocation</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4514</th>\n",
       "      <td>南京</td>\n",
       "      <td>411.0</td>\n",
       "      <td>122.0</td>\n",
       "      <td>15:50前可订今日票</td>\n",
       "      <td>564373921904</td>\n",
       "      <td>4.8</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>122.0</td>\n",
       "      <td>南京</td>\n",
       "      <td>2327.0</td>\n",
       "      <td>2</td>\n",
       "      <td>None</td>\n",
       "      <td>【当天可订立即出票】南京弘阳未来世界门票弘阳欢乐世界游乐场</td>\n",
       "      <td>vocation</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      city  fields.comment  fields.discountPrice fields.features  \\\n",
       "47863   澳门            43.0                  81.0         平均2分钟出票   \n",
       "46474   重庆             0.0                  92.0     15:00前可订今日票   \n",
       "41253   宝鸡             0.0                 288.0     14:00前可订今日票   \n",
       "4947    徐州             0.0                  66.0     16:30前可订今日票   \n",
       "4514    南京           411.0                 122.0     15:50前可订今日票   \n",
       "\n",
       "       fields.itemId  fields.itemTotalScore  fields.latitude  \\\n",
       "47863   581212914850                    5.0              0.0   \n",
       "46474   588002298859                    0.0              0.0   \n",
       "41253   592644497614                    0.0              0.0   \n",
       "4947    591338865284                    0.0              0.0   \n",
       "4514    564373921904                    4.8              0.0   \n",
       "\n",
       "       fields.longitude  fields.price fields.shortInfo  fields.sold365  \\\n",
       "47863               0.0          81.0               澳门           347.0   \n",
       "46474               0.0          92.0               重庆             NaN   \n",
       "41253               0.0         288.0               宝鸡             NaN   \n",
       "4947                0.0          66.0               徐州             NaN   \n",
       "4514                0.0         122.0               南京          2327.0   \n",
       "\n",
       "       fields.soldRecentNum fields.tagList                    fields.title  \\\n",
       "47863                    47           None  即订即用●澳门威尼斯人酒店贡多拉船船票 威尼斯人贡多拉游船票   \n",
       "46474                     0           None  蘑菇总动员入园游览票+蘑菇房VR体验2项成人套票（及时入园）   \n",
       "41253                     0           None  宝鸡太白山国家森林公园门票+太白山尚境温泉门票 西安旅游门票   \n",
       "4947                      0           None           徐州新沂窑湾古镇门票 窑湾古镇成人票电子票   \n",
       "4514                      2           None   【当天可订立即出票】南京弘阳未来世界门票弘阳欢乐世界游乐场   \n",
       "\n",
       "      trip_main_busness_type province  discount  \n",
       "47863               vocation       澳门      10.0  \n",
       "46474               vocation      重庆市      10.0  \n",
       "41253               vocation      陕西省      10.0  \n",
       "4947                vocation      江苏省      10.0  \n",
       "4514                vocation      江苏省      10.0  "
      ]
     },
     "execution_count": 495,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_final.sample(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 500,
   "metadata": {},
   "outputs": [],
   "source": [
    "level = ['A', 'AA', 'AAA', '4A景区', '5A景区']\n",
    "level_data = data_final.groupby('fields.tagList')['fields.price'].mean()[level]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 504,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "fields.tagList\n",
       "4A景区     79.781033\n",
       "5A景区    121.984286\n",
       "A        72.377778\n",
       "AA       71.005000\n",
       "AAA      53.908148\n",
       "今日可用    162.322308\n",
       "山        95.000000\n",
       "明日可用    158.617455\n",
       "景点      142.800000\n",
       "演出      276.666667\n",
       "赛事      150.000000\n",
       "Name: fields.price, dtype: float64"
      ]
     },
     "execution_count": 504,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_final.groupby('fields.tagList')['fields.price'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 502,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "fields.tagList\n",
       "A        72.377778\n",
       "AA       71.005000\n",
       "AAA      53.908148\n",
       "4A景区     79.781033\n",
       "5A景区    121.984286\n",
       "Name: fields.price, dtype: float64"
      ]
     },
     "execution_count": 502,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "level_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 508,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<script>\n",
       "    require.config({\n",
       "        paths: {\n",
       "            'echarts': '/nbextensions/echarts/echarts.min'\n",
       "        }\n",
       "    });\n",
       "</script>\n",
       "    <div id=\"8524b64b68774953bef208ed4e766bd4\" style=\"width:500px;height:500px;\"></div>\n",
       "\n",
       "\n",
       "<script>\n",
       "    require(['echarts'], function(echarts) {\n",
       "        \n",
       "var myChart_8524b64b68774953bef208ed4e766bd4 = echarts.init(document.getElementById('8524b64b68774953bef208ed4e766bd4'), null, {renderer: 'canvas'});\n",
       "var option_8524b64b68774953bef208ed4e766bd4 = {\n",
       "    \"title\": [\n",
       "        {\n",
       "            \"text\": \"\\u5404\\u7ea7\\u522b\\u666f\\u533a\\u7684\\u95e8\\u7968\\u4ef7\\u683c\",\n",
       "            \"subtext\": \"\",\n",
       "            \"left\": \"auto\",\n",
       "            \"top\": \"auto\",\n",
       "            \"textStyle\": {\n",
       "                \"color\": \"#000\",\n",
       "                \"fontSize\": 18\n",
       "            },\n",
       "            \"subtextStyle\": {\n",
       "                \"color\": \"#aaa\",\n",
       "                \"fontSize\": 12\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"toolbox\": {\n",
       "        \"show\": true,\n",
       "        \"orient\": \"vertical\",\n",
       "        \"left\": \"95%\",\n",
       "        \"top\": \"center\",\n",
       "        \"feature\": {\n",
       "            \"saveAsImage\": {\n",
       "                \"show\": true,\n",
       "                \"title\": \"\\u4e0b\\u8f7d\\u56fe\\u7247\"\n",
       "            },\n",
       "            \"restore\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"dataView\": {\n",
       "                \"show\": true\n",
       "            }\n",
       "        }\n",
       "    },\n",
       "    \"series_id\": 2500198,\n",
       "    \"tooltip\": {\n",
       "        \"trigger\": \"item\",\n",
       "        \"triggerOn\": \"mousemove|click\",\n",
       "        \"axisPointer\": {\n",
       "            \"type\": \"line\"\n",
       "        },\n",
       "        \"formatter\": null,\n",
       "        \"textStyle\": {\n",
       "            \"color\": \"#fff\",\n",
       "            \"fontSize\": 14\n",
       "        },\n",
       "        \"backgroundColor\": \"rgba(50,50,50,0.7)\",\n",
       "        \"borderColor\": \"#333\",\n",
       "        \"borderWidth\": 0\n",
       "    },\n",
       "    \"series\": [\n",
       "        {\n",
       "            \"type\": \"bar\",\n",
       "            \"name\": \"\",\n",
       "            \"data\": [\n",
       "                72.0,\n",
       "                71.0,\n",
       "                54.0,\n",
       "                80.0,\n",
       "                122.0\n",
       "            ],\n",
       "            \"stack\": \"stack_2500198\",\n",
       "            \"barCategoryGap\": \"20%\",\n",
       "            \"label\": {\n",
       "                \"normal\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": \"top\",\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#000\",\n",
       "                        \"fontSize\": 12\n",
       "                    },\n",
       "                    \"formatter\": null\n",
       "                },\n",
       "                \"emphasis\": {\n",
       "                    \"show\": true,\n",
       "                    \"position\": null,\n",
       "                    \"textStyle\": {\n",
       "                        \"color\": \"#fff\",\n",
       "                        \"fontSize\": 12\n",
       "                    }\n",
       "                }\n",
       "            },\n",
       "            \"markPoint\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"markLine\": {\n",
       "                \"data\": []\n",
       "            },\n",
       "            \"seriesId\": 2500198\n",
       "        }\n",
       "    ],\n",
       "    \"legend\": [\n",
       "        {\n",
       "            \"data\": [\n",
       "                \"\"\n",
       "            ],\n",
       "            \"selectedMode\": \"multiple\",\n",
       "            \"show\": true,\n",
       "            \"left\": \"center\",\n",
       "            \"top\": \"top\",\n",
       "            \"orient\": \"horizontal\",\n",
       "            \"textStyle\": {\n",
       "                \"fontSize\": 12,\n",
       "                \"color\": \"#333\"\n",
       "            }\n",
       "        }\n",
       "    ],\n",
       "    \"backgroundColor\": \"#fff\",\n",
       "    \"xAxis\": [\n",
       "        {\n",
       "            \"name\": \"\",\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"interval\": \"auto\",\n",
       "                \"rotate\": 0,\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 18,\n",
       "                    \"color\": \"#000\"\n",
       "                }\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"position\": null,\n",
       "            \"boundaryGap\": true,\n",
       "            \"min\": null,\n",
       "            \"max\": null,\n",
       "            \"data\": [\n",
       "                \"A\",\n",
       "                \"AA\",\n",
       "                \"AAA\",\n",
       "                \"4A\\u666f\\u533a\",\n",
       "                \"5A\\u666f\\u533a\"\n",
       "            ],\n",
       "            \"type\": \"category\"\n",
       "        }\n",
       "    ],\n",
       "    \"yAxis\": [\n",
       "        {\n",
       "            \"name\": \"\",\n",
       "            \"show\": true,\n",
       "            \"nameLocation\": \"middle\",\n",
       "            \"nameGap\": 25,\n",
       "            \"nameTextStyle\": {\n",
       "                \"fontSize\": 14\n",
       "            },\n",
       "            \"axisLabel\": {\n",
       "                \"formatter\": \"{value} \",\n",
       "                \"rotate\": 0,\n",
       "                \"interval\": \"auto\",\n",
       "                \"margin\": 8,\n",
       "                \"textStyle\": {\n",
       "                    \"fontSize\": 14,\n",
       "                    \"color\": \"#000\"\n",
       "                }\n",
       "            },\n",
       "            \"axisTick\": {\n",
       "                \"alignWithLabel\": false\n",
       "            },\n",
       "            \"inverse\": false,\n",
       "            \"position\": null,\n",
       "            \"boundaryGap\": true,\n",
       "            \"min\": null,\n",
       "            \"max\": null,\n",
       "            \"splitLine\": {\n",
       "                \"show\": true\n",
       "            },\n",
       "            \"type\": \"value\"\n",
       "        }\n",
       "    ],\n",
       "    \"color\": [\n",
       "        \"#c23531\",\n",
       "        \"#2f4554\",\n",
       "        \"#61a0a8\",\n",
       "        \"#d48265\",\n",
       "        \"#749f83\",\n",
       "        \"#ca8622\",\n",
       "        \"#bda29a\",\n",
       "        \"#6e7074\",\n",
       "        \"#546570\",\n",
       "        \"#c4ccd3\",\n",
       "        \"#f05b72\",\n",
       "        \"#ef5b9c\",\n",
       "        \"#f47920\",\n",
       "        \"#905a3d\",\n",
       "        \"#fab27b\",\n",
       "        \"#2a5caa\",\n",
       "        \"#444693\",\n",
       "        \"#726930\",\n",
       "        \"#b2d235\",\n",
       "        \"#6d8346\",\n",
       "        \"#ac6767\",\n",
       "        \"#1d953f\",\n",
       "        \"#6950a1\",\n",
       "        \"#918597\",\n",
       "        \"#f6f5ec\"\n",
       "    ]\n",
       "};\n",
       "myChart_8524b64b68774953bef208ed4e766bd4.setOption(option_8524b64b68774953bef208ed4e766bd4);\n",
       "\n",
       "    });\n",
       "</script>\n"
      ],
      "text/plain": [
       "<pyecharts.charts.bar.Bar at 0x11f131860>"
      ]
     },
     "execution_count": 508,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bar = Bar(\"各级别景区的门票价格\", width = 500,height=500)\n",
    "bar.add(\"\", level_data.index, np.round(level_data.values,0), is_stack=True, \n",
    "       xaxis_label_textsize=18, yaxis_label_textsize=14, is_label_show=True)\n",
    "bar"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
